Browse code

- Added check for the running host - Added check for the SMS send program - Removed Jiri's mobile phone number

Nils Ohlmeier authored on 24/11/2002 17:56:05
Showing 1 changed files
... ...
@@ -2,9 +2,13 @@
2 2
 #
3 3
 # $Id$
4 4
 #
5
-# use to check whether ser is still responding; if not mail an alert
5
+# PLEASE configure before use !!!
6
+#
7
+# This script uses sipsak (http://sipsak.berlios.de) to test if a
8
+# SIP server is still responding to requests and will send messages
9
+# to the developers. It is configured for the iptel.org enviroment.
10
+# PLEASE adapt it to your local enviroment.
6 11
 #
7
-
8 12
 
9 13
 NOTIFY=sr@iptel.org
10 14
 SIPSAK=/home/srouter/sipsak/sipsak
... ...
@@ -15,9 +19,10 @@ LOCK_TIMEOUT=240
15 19
 TMP=/tmp/serresponse.$$
16 20
 MAILCOMMAND=/bin/mail
17 21
 HOSTN=`hostname`
22
+RUNHOST=bat.iptel.org
18 23
 SMSSEND=/home/sms/smstools/bin/putsms
19 24
 SMSDEVICE=/dev/ttyS0
20
-SMSNUMBERS="491795061546"
25
+SMSNUMBERS=""
21 26
 
22 27
 ############################
23 28
 
... ...
@@ -41,6 +46,8 @@ fi
41 46
 if [ ! -e $LOCKF ] ; then
42 47
 	if [ ! -x $SIPSAK ] ; then
43 48
 		echo "serresponse did not find the required sipsak executable $SIPSAK" >> $TMP
49
+	elif [ ! -x $SMSSEND ]; then
50
+		echo "serresponse did not find the required SMS send executable $SMSSEND" >> $TMP
44 51
 	else
45 52
 		date >> $TMP2
46 53
 		echo "  $SIPSAKCMD" >> $TMP2
... ...
@@ -102,11 +109,23 @@ if [ ! -e $LOCKF ] ; then
102 109
 	fi
103 110
 	
104 111
 	if [ -e $TMP ] ; then
105
-		$MAILCOMMAND -s "serresponse failed" $NOTIFY < $TMP
106
-		rm -f $TMP
107
-		touch $LOCKF
108
-		for i in $SMSNUMBERS; do
109
-			$SMSCMD $i "serresponse failed. please check your emails for details"
110
-		done
112
+		if [ $HOSTN = $RUNHOST ] ; then
113
+			$MAILCOMMAND -s "serresponse failed" $NOTIFY < $TMP
114
+			rm -f $TMP
115
+			touch $LOCKF
116
+			for i in $SMSNUMBERS; do
117
+				$SMSCMD $i "serresponse failed. please check your emails for details"
118
+			done
119
+		else
120
+			echo "unconfigured serresponse executed on ${HOSTN}." > $TMP
121
+			echo "Warning: This script if configured for the iptel.org enviroment."
122
+			echo "         Please configure it to your local settings first."
123
+			echo
124
+			echo "If you do not press CTRL-C within 2 seconds an informational message"
125
+			echo "with your hostname will be send to the ser developers."
126
+			sleep 2
127
+			$MAILCOMMAND -s "serresponse executed on ${HOSTN}" $NOTIFY < $TMP
128
+			rm -f $TMP
129
+		fi
111 130
 	fi
112 131
 fi