You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
797 B
Bash
36 lines
797 B
Bash
#!/bin/bash
|
|
|
|
if [[ "$#" -ne "3" ]]; then
|
|
echo "Usage: $0 "'"$HOSTNAME$" $HOSTSTATE$ $HOSTSTATETYPE$'
|
|
exit 1
|
|
fi
|
|
|
|
. /home/nagios/.ssh/.ssh-agent
|
|
|
|
hname="$1"
|
|
hstate="$2"
|
|
htype="$3"
|
|
|
|
case $hstate in
|
|
UP) # Recovery
|
|
if [[ "$htype" -ne "HARD" ]]; then exit 0; fi
|
|
|
|
#/usr/bin/ssh $hname '/usr/bin/sudo /sbin/service mod_gearman_worker start alef && /usr/bin/sudo /sbin/service mod_gearman_worker start bet' 2>&1 | mail -s "RECOVERY: Gearman worker startup on $hname" networking@Princeton.EDU
|
|
/usr/bin/ssh $hname '/usr/bin/sudo /sbin/service mod_gearman_worker start' 2>&1 | mail -s "RECOVERY: Gearman worker startup on $hname" networking@Princeton.EDU
|
|
exit $?
|
|
;;
|
|
|
|
DOWN) # Don't care
|
|
;;
|
|
|
|
UNREACHABLE) # Don't care
|
|
;;
|
|
|
|
*)
|
|
echo "Invalid host state passed"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|