gaspode.sh (460B)
1 #!/bin/sh 2 deadline=$(expr $(date +%s) + ${HEADSTART}) 3 services=$@ 4 echo started feeding the dog 5 exec 3> ${WATCHDOG-/dev/watchdog} 6 7 healthy(){ 8 test $(date +%s) -le $deadline && return 0 9 10 for i in $services; do 11 if test "$(s6-svstat -o up /run/service/$i)" != "true" ; then 12 echo "service $i is down" 13 return 1 14 fi 15 done 16 } 17 18 while healthy ;do 19 sleep 10 20 echo >&3 21 done 22 echo "stopped feeding the dog" 23 sleep 6000 # don't want s6-rc to restart