File: monitor-example-command.sh

package info (click to toggle)
foomuuri 0.30-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 764 kB
  • sloc: python: 3,389; makefile: 110; sh: 39
file content (18 lines) | stat: -rwxr-xr-x 504 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

# This is an example shell script how to use curl instead of fping to monitor
# network connectivity.
#
# target foobar {
#   command /etc/foomuuri/monitor-example-command.sh
#   command_up /etc/foomuuri/monitor.event
#   command_down /etc/foomuuri/monitor.event
# }

while true; do
    # Echoed text must be "OK" or "ERROR", everything else is ignored
    [ "$(curl --silent http://foobar.fi/test/connectivity)" = "OK" ] && echo OK || echo ERROR

    # Small wait and repeat
    sleep 5
done