Implemented LSB init scripts compliance.
[udpgate.git] / init.d / udpgate.init
index 01f92bf..5c72dc7 100755 (executable)
@@ -2,31 +2,30 @@
 # Startup script for udpgate
 #
 # chkconfig: 2345 98 02
-# description: UDP packats gateway
+# description: UDP packets gateway
 
-# Source function library.
-. /etc/rc.d/init.d/functions
-
-# Where we are?
-# [ -f /usr/bin/udpgate ] || exit 0
+# Source our configuration file for these variables.
+PORT=9201
+LOCATION=/usr/bin/udpgate
+if [ -f /etc/sysconfig/udpgate ] ; then
+       . /etc/sysconfig/udpgate
+fi
 
 prog="udpgate"
 
 start() {
        echo -n $"Starting $prog: " 
-       daemon udpgate --start
+       $LOCATION --start --port=$PORT
        RETVAL=$?
        echo
        return $RETVAL
 }
 
 stop() {
-       if test "x`pidof udpgate`" != x; then
-               echo -n $"Stopping $prog: "
-               killproc udpgate
-               echo
-       fi
+       echo -n $"Stopping $prog: "
+       $LOCATION --stop
        RETVAL=$?
+       echo
        return $RETVAL
 }
 
@@ -34,27 +33,22 @@ case "$1" in
                start)
                        start
                        ;;
-               
                stop)
                        stop
                        ;;
-               
                status)
-                       status udpgate
                        ;;
                restart)
                        stop
                        start
                        ;;
                condrestart)
-                       if test "x`pidof udpgate`" != x; then
-                               stop
-                               start
-                       fi
+                       stop
+                       start
                        ;;
                
                *)
-                       echo $"Usage: $0 {start|stop|restart|condrestart|status}"
+                       echo $"Usage: $0 {start|stop|restart}"
                        exit 1
 
 esac