Make "wakeup delay" configurable: WAKE_DELAY
[trigger-rcmd.git] / scripts / trigger-rcmd
index c21a21f55103bdca0484092b81660181445f4fb0..c8f92ba68fc987a456a0f2bb9892d251222cade9 100755 (executable)
@@ -26,6 +26,7 @@ do_rcmd() {
        CMD="uptime"
        TIMEOUT="180"
        SSH_CHECKS="6"
+       WAKE_DELAY="10s"
 
        . "$cnf"
 
@@ -61,7 +62,7 @@ do_rcmd() {
                        echo "$NAME: failed to wake \"$SYSTEM\"!" >&2
                        return 4
                fi
-               sleep 3
+               sleep "$WAKE_DELAY"
                rsys_was_running=0
        else
                echo "$NAME: \"$SYSTEM\" is already alive, ok."
@@ -88,7 +89,7 @@ do_rcmd() {
                rsys_users=`ssh -q "$SYSTEM" w | tail -n +3 | wc -l`
                if [ "$rsys_users" = "0" ]; then
                        echo "$NAME: power off \"$SYSTEM\" again ..."
-                       ssh -q "$SYSTEM" "sync; shutdown -hP +1"
+                       ssh -q "$SYSTEM" "sync; shutdown -hP +1" >/dev/null
                        if [ $? -ne 0 ]; then
                                echo "$NAME: failed to power off \"$SYSTEM\"!" >&2
                                return 5