Browse code

added init.d script for watching SIP traffic

Jiri Kuthan authored on 23/08/2003 20:44:58
Showing 1 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,41 @@
1
+#!/bin/sh
2
+#
3
+# chkconfig: 2345 20 80
4
+# description: controls execution of SIP sniffer
5
+# processname: ng
6
+
7
+NAME=ng
8
+OPTIONS="-L -t port 5060"
9
+BIN=/usr/local/bin/$NAME
10
+ROTATE=/usr/sbin/rotatelogs
11
+
12
+RETVAL=0
13
+
14
+
15
+# See how we were called.
16
+case "$1" in
17
+  start)
18
+  	killall $NAME
19
+	echo -n "Starting SIP sniffer: "
20
+	$BIN $OPTIONS 2>&1 | $ROTATE /var/log/sip/sip 86400 &
21
+	RETVAL=$?
22
+	echo "ngrep."
23
+	;;
24
+  stop)
25
+	echo -n "Stopping SIP ngrep: "
26
+	killall $NAME
27
+	RETVAL=$?
28
+        echo "done."
29
+	;;
30
+  restart)
31
+	#$0 stop
32
+	$0 start
33
+	RETVAL=$?
34
+	;;
35
+  *)
36
+	echo "Usage: $0 {start|stop|restart}"
37
+	exit 1
38
+esac
39
+
40
+exit $RETVAL
41
+