Main page
Recent changes
Watchdog-ping
New name
B
I
U
S
link
image
code
list
Show page
Syntax
How to configure the relay for interrupt (reset) any (modem) devices due to failed PINGs. Create bash scripts, open{{vim /etc/init.d/watchdog-ping}} and paste {{ #!/bin/sh # BEGIN INIT INFO # Provides: edge # Required-Start: $network $remote_fs $syslog # Required-Stop: $network $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: # Short-Description: Start watchdog ping # END INIT INFO WAIT="60" # sec IP="192.168.11.197" # IP or URL RELAY="6" # number relay (1-8) while true; do while ping -qc 1 $IP >/dev/null do sleep $WAIT done sleep $WAIT echo "1" > /home/pi/remoteqth/cfg/gpio$RELAY sleep 1 echo "0" > /home/pi/remoteqth/cfg/gpio$RELAY done exit 0 }} set {{chmod 774 /etc/init.d/watchdog-ping}} There are two possibilities # run script directly{{/etc/init.d/watchdog-ping}} # or update-rc.d n2n defaults}}
Password
Summary of changes