bump version number to 0.91
[openggsn.git] / examples / ggsn.init
blob7d9689a4ce602f20dd31a99212e0eb1ef3ae1f6f
1 #!/bin/sh
3 # ggsn This shell script takes care of starting and stopping
4 # ggsn.
6 # chkconfig: - 65 35
7 # description: ggsn is a Gateway GPRS Support Node.
9 # Source function library.
10 . /etc/rc.d/init.d/functions
12 # Source networking configuration.
13 . /etc/sysconfig/network
15 if [ -f /etc/sysconfig/ggsn ]; then
16 . /etc/sysconfig/ggsn
19 # Check that networking is up.
20 [ ${NETWORKING} = "no" ] && exit 0
22 [ -f /usr/bin/ggsn ] || exit 0
23 [ -f /etc/ggsn.conf ] || exit 0
25 RETVAL=0
26 prog="ggsn"
28 start() {
29 # Start daemons.
30 echo -n $"Starting $prog: "
32 # Load tun module
33 /sbin/modprobe tun >/dev/null 2>&1
35 # Enable routing of packets: WARNING!!!
36 # Users should enable this explicitly
37 # echo 1 > /proc/sys/net/ipv4/ip_forward
39 # Check for runtime directory of nonvolatile data
40 if [ ! -d /var/lib/ggsn ]; then
41 mkdir /var/lib/ggsn
44 # Check for GTP restart counter
45 if [ ! -d /var/lib/ggsn/gsn_restart ]; then
46 echo 0 > /var/lib/ggsn/gsn_restart
50 daemon /usr/bin/ggsn
51 RETVAL=$?
52 echo
53 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ggsn
54 return $RETVAL
57 stop() {
58 # Stop daemons.
59 echo -n $"Shutting down $prog: "
60 killproc ggsn
61 RETVAL=$?
62 echo
63 [ $RETVAL = 0 ] && rm -f /var/lock/subsys/ggsn /var/run/ggsn.pid
64 return $RETVAL
67 # See how we were called.
68 case "$1" in
69 start)
70 start
72 stop)
73 stop
75 restart|reload)
76 stop
77 start
78 RETVAL=$?
80 condrestart)
81 if [ -f /var/lock/subsys/ggsn ] ; then
82 stop
83 start
84 RETVAL=$?
87 status)
88 status ggsn
89 RETVAL=$?
92 echo $"Usage: $0 {start|stop|restart|condrestart|status}"
93 exit 1
94 esac
96 exit $RETVAL