| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# This is an example shell script how to use curl instead of fping to monitor |
| 4 |
# network connectivity. |
| 5 |
# |
| 6 |
# target foobar { |
| 7 |
# command /etc/foomuuri/monitor-example-command.sh |
| 8 |
# command_up /etc/foomuuri/monitor.event |
| 9 |
# command_down /etc/foomuuri/monitor.event |
| 10 |
# } |
| 11 |
|
| 12 |
while true; do |
| 13 |
# Echoed text must be "OK" or "ERROR", everything else is ignored |
| 14 |
[ "$(curl --silent http://foobar.fi/test/connectivity)" = "OK" ] && echo OK || echo ERROR |
| 15 |
|
| 16 |
# Small wait and repeat |
| 17 |
sleep 5 |
| 18 |
done |