]> arthur.barton.de Git - trigger-rcmd.git/blobdiff - scripts/trigger-rcmd
SSH: Don't set "ServerAliveInterval" option explicitely
[trigger-rcmd.git] / scripts / trigger-rcmd
index 9c23ae06e227c797d19c6a2930099051a3ff8d87..0ec4bec33b7f0b030af12728d3157a0b3829eb2f 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 # trigger-rcmp: Trigger remote commands
-# Copyright (c)2014 Alexander Barton (alex@barton.de)
+# Copyright (c)2014-2015 Alexander Barton (alex@barton.de)
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@ RCMD_D="/usr/local/etc/rcmd.d"
 PATH="$PATH:/usr/local/sbin:/usr/sbin"
 
 do_help() {
-       echo "Usage: $0 <rcmd> [<rcmd> [...]]" >&2
+       echo "Usage: $0 [--no-wake|-n] <rcmd> [<rcmd> [...]]" >&2
        exit 2
 }
 
@@ -24,7 +24,7 @@ do_rcmd() {
        SYSTEM="localhost"
        IFACE="eth0"
        CMD="uptime"
-       TIMEOUT="180"
+       TIMEOUT="300"
        SSH_CHECKS="6"
        WAKE_DELAY="10s"
        BOOT_DELAY="1m"
@@ -117,6 +117,15 @@ do_rcmd() {
 # Defaults
 NO_WAKE=
 
+# Check required tools
+for t in fping ssh etherwake; do
+       type "$t" >/dev/null 2>&1
+       if [ $? -ne 0 ]; then
+               echo "$NAME: Required tool \"$t\" missing, aborting!"
+               exit 3
+       fi
+done
+
 while [ $# -gt 0 ]; do
        case "$1" in
          --no-wake|-n)