X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dsa-metapackages.git;a=blobdiff_plain;f=buildd-reboot;h=3ba1f045b6a8b43216574ab237c8a8f094b18c8a;hp=237fb8b8b0e38304872e629501a532f121ae295a;hb=4a37792f975f598b2d27224a081b60da117e7ac6;hpb=f0d5b2ab28621ea2f853cbd97942e326fcb1670a;ds=sidebyside diff --git a/buildd-reboot b/buildd-reboot index 237fb8b..3ba1f04 100755 --- a/buildd-reboot +++ b/buildd-reboot @@ -79,10 +79,13 @@ buildd_wait_and_reboot() { echo fi + if grep 'waiting-for-clean-shutdown' ~buildd/NO-DAEMON-PLEASE > /dev/null; then + sudo -u buildd sh -c 'echo delete-on-boot > ~buildd/NO-DAEMON-PLEASE' + fi if [ "$halt" = 1 ]; then - /sbin/shutdown -h 15 "$reason" + /sbin/shutdown -h 1 "$reason" else - /sbin/shutdown -r 15 "$reason" + /sbin/shutdown -r 1 "$reason" fi } @@ -103,13 +106,17 @@ if ! test -e ~buildd/NO-DAEMON-PLEASE; then if [ -e ~buildd/build/buildd.pid ] ; then echo "Touching ~buildd/NO-DAEMON-PLEASE ~buildd/EXIT-DAEMON-PLEASE" sudo -u buildd touch ~buildd/NO-DAEMON-PLEASE ~buildd/EXIT-DAEMON-PLEASE - sudo -u buildd sh -c 'echo delete-on-boot > ~buildd/NO-DAEMON-PLEASE' + sudo -u buildd sh -c 'echo waiting-for-clean-shutdown > ~buildd/NO-DAEMON-PLEASE' sudo chgrp -v adm ~buildd/NO-DAEMON-PLEASE echo "Sending HUP to buildd" sudo -u buildd kill -HUP `sudo cat ~buildd/build/buildd.pid` else echo "no-daemon-please does not exist, but there is no buildd.pid file either" + if pgrep -u buildd -x buildd ; then + echo "But there is a buildd running. Bad?" + exit 3 + fi fi else echo "no-daemon-please already exists"