Make "shutdown time" configurable: SHUTDOWN_TIME
[trigger-rcmd.git] / scripts / trigger-rcmd
index b0c1aa9b2d3e4d2ea4dd299e61bbd8fd068d88bd..7d90e3bcc4bb750e2863e785bb51dc794bd53d5a 100755 (executable)
@@ -26,6 +26,8 @@ do_rcmd() {
        CMD="uptime"
        TIMEOUT="180"
        SSH_CHECKS="6"
+       WAKE_DELAY="10s"
+       SHUTDOWN_TIME="+10"
 
        . "$cnf"
 
@@ -61,7 +63,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 +90,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" >/dev/null
+                       ssh -q "$SYSTEM" "sync; shutdown -hP $SHUTDOWN_TIME" >/dev/null
                        if [ $? -ne 0 ]; then
                                echo "$NAME: failed to power off \"$SYSTEM\"!" >&2
                                return 5