Browse code

Added check on local errors.

Nils Ohlmeier authored on 03/07/2002 15:24:10
Showing 1 changed files
... ...
@@ -42,7 +42,7 @@ if [ ! -e $LOCKF ] ; then
42 42
 		echo "  $BIN -s $SIPURI" >> $TMP2
43 43
 		echo "produced this output:" >> $TMP2
44 44
 		$BIN -s $SIPURI >> $TMP2 2>&1
45
-		if [ $? -ne 0 ] ; then
45
+		if [ $? -eq 1 ] ; then
46 46
 			echo "  $BIN -n -s $SIPURI" >> $TMP3
47 47
 			echo "produced this output:" >> $TMP3
48 48
 			$BIN -n -s $SIPURI >> $TMP3 2>&1
... ...
@@ -53,9 +53,10 @@ if [ ! -e $LOCKF ] ; then
53 53
 				echo "" >> $TMP
54 54
 				echo "Sending this alert is stopped for $LOCK_TIMEOUT minutes." >>$TMP
55 55
 				echo "If you want to re-enable alerts sooner, please remove the lock file" >> $TMP
56
-				echo "$LOCKF @ $HOSTN (you presumably need to be root to do this)" >> $TMP
56
+				echo "$LOCKF @ $HOSTN" >> $TMP
57
+				echo "(you presumably need to be root to do this)" >> $TMP
57 58
 				echo "" >> $TMP
58
-				echo "command output of sipsak with fqdn follows:" >> $TMP
59
+				echo "Command output of sipsak with fqdn follows:" >> $TMP
59 60
 				cat $TMP2 >> $TMP
60 61
 			else
61 62
 				echo "ser did not responses (fast enough) on requests with fqdn in Via" >> $TMP
... ...
@@ -64,14 +65,29 @@ if [ ! -e $LOCKF ] ; then
64 65
 				echo "" >> $TMP
65 66
 				echo "Sending this alert is stopped for $LOCK_TIMEOUT minutes." >>$TMP
66 67
 				echo "If you want to re-enable alerts sooner, please remove the lock file" >> $TMP
67
-				echo "$LOCKF @ $HOSTN (you presumably need to be root to do this)" >> $TMP
68
+				echo "$LOCKF @ $HOSTN" >> $TMP
69
+				echo "(you presumably need to be root to do this)" >> $TMP
68 70
 				echo "" >> $TMP
69
-				echo "first command output with fqdn follows then with IPs:" >> $TMP
71
+				echo "First command output with fqdn:" >> $TMP
70 72
 				cat $TMP2 >> $TMP
73
+				echo "" >> $TMP
74
+				echo "Second command output with IPs in Via:" >> $TMP
71 75
 				cat $TMP3 >> $TMP
72 76
 			fi
73 77
 			rm -f $TMP3
74 78
 			rm -f $TMP2
79
+		elif [ $? -eq 2 ] ; then
80
+			echo "The ser response test failed due to a local error on" >> $TMP
81
+			echo "host $HOSTN ." >> $TMP
82
+			echo "" >> $TMP
83
+			echo "Sending this alert is stopped for $LOCK_TIMEOUT minutes." >>$TMP
84
+			echo "If you want to re-enable alerts sooner, please remove the lock file" >> $TMP
85
+			echo "$LOCKF @ $HOSTN" >> $TMP
86
+			echo "(you presumably need to be root to do this)" >> $TMP
87
+			echo "" >> $TMP
88
+			echo "Command output of sipsak with fqdn follows:" >> $TMP
89
+			cat $TMP2 >> $TMP
90
+			rm -f $TMP2
75 91
 		else
76 92
 			rm -f $TMP2
77 93
 			rm -f $TMP