Test for required external commands
authorAlexander Barton <alex@barton.de>
Mon, 7 Dec 2015 09:08:47 +0000 (10:08 +0100)
committerAlexander Barton <alex@barton.de>
Mon, 7 Dec 2015 09:08:47 +0000 (10:08 +0100)
scripts/trigger-rcmd

index 34f6f4d..17fd8a3 100755 (executable)
@@ -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)