]>
git.sthu.org Git - shutils.git/blob - checkserver.sh
9 [ "$VERBOSE" = "1" ] && echo "$@"
13 log
"Check DNS lookup for '$1'."
14 if ! host "$1" 8.8.8.8 > /dev
/null
; then
15 failed
"DNS lookup at 8.8.8.8 for '$1' failed."
20 log
"Check web server at '$1'."
21 if ! curl
-s "$1" > /dev
/null
; then
22 failed
"Failed to retrieve website '$1'."
27 log
"Check mail server at '$1'."
28 if ! echo "quit" | nc
"$1" 587 |
grep -m1 "^220 $1" > /dev
/null
; then
29 failed
"Checking mail server '$1' failed."
34 log
"Check disk filling at '$1'."
35 DF
=$
(ssh aristoteles.sthu.org
"df -h | grep /$ | grep -o '[0-9]*%' | head -c -2")
36 if [ -n "$DF" ] && ! [ $DF -lt 80 ]; then
37 failed
"Checking disk filling at '$1' failed."
43 if ! host 8.8.8.8 8.8.8.8 > /dev
/null
; then
44 log
"We do not appear to be connected to the internet."
58 -v Print verbose output.
59 -a ADDRESS Check DNS (reverse) lookup.
60 -w ADDRESS Check webserver.
61 -m ADDRESS Check mailserver.
62 -d ADDRESS Check disk filling.
66 source $HOME/.profile-sshagent
71 while getopts "vha:w:m:d:" OPTION
; do
85 checkWebserver
$OPTARG
88 checkMailserver
$OPTARG
91 checkDiskfilling
$OPTARG