From 7be9bd805579a9dca5c70599b51eb533df169a0b Mon Sep 17 00:00:00 2001 From: jjako Date: Sun, 6 Jul 2003 17:33:03 +0000 Subject: [PATCH] New ggsn Sys V init file and updated ggsn.conf --- examples/ggsn.conf | 9 ++--- examples/ggsn.init | 97 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 5 deletions(-) create mode 100644 examples/ggsn.init diff --git a/examples/ggsn.conf b/examples/ggsn.conf index 9fb62f6..bbc0f05 100644 --- a/examples/ggsn.conf +++ b/examples/ggsn.conf @@ -7,7 +7,7 @@ # TAG: fg # Include this flag if process is to run in the foreground # -fg +#fg # TAG: debug # Include this flag to include debug information. @@ -32,7 +32,7 @@ fg # TAG: listen # Specifies the local IP address to listen to -listen 10.0.0.240 +#listen 10.0.0.240 # TAG: net # IP network address of external packet data network @@ -52,15 +52,14 @@ listen 10.0.0.240 # TAG: dynip # Dynamic IP address pool. # Used for allocation of dynamic IP address when address is not given -# by HLR or radius server. +# by HLR. # If this option is not given then the net option is used as a substitute. #dynip 192.168.0.0/24 # TAG: statip # Use of this tag is currently UNSUPPORTED # Static IP address pool. -# Used for allocation of static IP address by means of either HLR or -# radius server. +# Used for allocation of static IP address by means of HLR. #statip 192.168.1.0/24 # TAG: pcodns1 diff --git a/examples/ggsn.init b/examples/ggsn.init new file mode 100644 index 0000000..b9c49e5 --- /dev/null +++ b/examples/ggsn.init @@ -0,0 +1,97 @@ +#!/bin/sh +# +# ggsn This shell script takes care of starting and stopping +# ggsn. +# +# chkconfig: - 65 35 +# description: ggsn is a Gateway GPRS Support Node. + +# Source function library. +. /etc/rc.d/init.d/functions + +# Source networking configuration. +. /etc/sysconfig/network + +if [ -f /etc/sysconfig/ggsn ]; then + . /etc/sysconfig/ggsn +fi + +# Check that networking is up. +[ ${NETWORKING} = "no" ] && exit 0 + +[ -f /usr/bin/ggsn ] || exit 0 +[ -f /etc/ggsn.conf ] || exit 0 + +RETVAL=0 +prog="ggsn" + +start() { + # Start daemons. + echo -n $"Starting $prog: " + + # Load tun module + /sbin/modprobe tun >/dev/null 2>&1 + + # Enable routing of packets: WARNING!!! + # Users should enable this explicitly + # echo 1 > /proc/sys/net/ipv4/ip_forward + + # Check for runtime directory of nonvolatile data + if [ ! -d /var/run/ggsn ]; then + mkdir /var/run/ggsn + fi + + # Check for GTP restart counter + if [ ! -d /var/run/ggsn/gsn_restart ]; then + echo 0 > /var/run/ggsn/gsn_restart + fi + + + daemon /usr/bin/ggsn + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ggsn + return $RETVAL +} + +stop() { + # Stop daemons. + echo -n $"Shutting down $prog: " + killproc ggsn + RETVAL=$? + echo + [ $RETVAL = 0 ] && rm -f /var/lock/subsys/ggsn /var/run/ggsn.pid + return $RETVAL +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|reload) + stop + start + RETVAL=$? + ;; + condrestart) + if [ -f /var/lock/subsys/ggsn ] ; then + stop + start + RETVAL=$? + fi + ;; + status) + status ggsn + RETVAL=$? + ;; + *) + echo $"Usage: $0 {start|stop|restart|condrestart|status}" + exit 1 +esac + +exit $RETVAL +