summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-07-03 09:12:36 +0200
committerErich Eckner <git@eckner.net>2017-07-03 09:12:36 +0200
commitf374df980982f59185a3de2b9cef8164bf837593 (patch)
tree0ada9f0d95229ec45c28a948b6ce464eb8dff27a
parente393c7341d40671476cbc3c75de02f60d77779eb (diff)
downloadbuilder-f374df980982f59185a3de2b9cef8164bf837593.tar.xz
bin/cleanup: skip auto-cleanup if users are logged in
-rwxr-xr-xbin/cleanup7
1 files changed, 7 insertions, 0 deletions
diff --git a/bin/cleanup b/bin/cleanup
index aa93004..f84d687 100755
--- a/bin/cleanup
+++ b/bin/cleanup
@@ -4,6 +4,13 @@
. "${0%/*}/../conf/default.conf"
+# we only clean if run interactive or if no one is logged in
+if ! tty -s && \
+ [ -n "$(users)" ]; then
+ >&2 echo 'Skipping clean up.'
+ exit
+fi
+
if ! "${base_dir}/bin/sanity-check" -r; then
>&2 echo 'Build master is not sane.'
exit 1