Implement "--no-wake" (-n) option
authorAlexander Barton <alex@barton.de>
Mon, 1 Sep 2014 22:33:30 +0000 (00:33 +0200)
committerAlexander Barton <alex@barton.de>
Mon, 1 Sep 2014 22:33:30 +0000 (00:33 +0200)
scripts/trigger-rcmd

index 7db861fb8e370119ff18c91f1986a9f0a8dbd091..97f4efafc9a75a29143de6b341916e087cbd03f0 100755 (executable)
@@ -38,6 +38,11 @@ do_rcmd() {
        echo "$NAME: checking system \"$SYSTEM\" ..."
        fping -c1 -q "$SYSTEM" 2>/dev/null
        if [ $? -ne 0 ]; then
+               if [ -n "$NO_WAKE" ]; then
+                       echo "$NAME: \"$SYSTEM\" seems to be down, skipping job."
+                       return 9
+               fi
+
                echo "$NAME: \"$SYSTEM\" seems to be down, wake it up ..."
                etherwake -b -i "$IFACE" `echo "$SYSTEM" | cut -d'.' -f1`
                if [ $? -ne 0 ]; then
@@ -92,8 +97,13 @@ do_rcmd() {
        [ $r -eq 0 ] && return 0 || return 1
 }
 
+# Defaults
+NO_WAKE=
+
 while [ $# -gt 0 ]; do
        case "$1" in
+         --no-wake|-n)
+               NO_WAKE=1; ;;
          --help|-*)
                do_help; ;;
          *)