4f526a6d70554b2631c7de62d5dcfcdeb3f9f02a
[udpgate.git] / init.d / udpgate.init
1 #! /bin/sh
2 # Startup script for udpgate
3 #
4 # chkconfig: 2345 98 02
5 # description: UDP packets gateway
6
7 # Source function library.
8 . /etc/rc.d/init.d/functions
9
10 # Source our configuration file for these variables.
11 PORT=9201
12 LOCATION=/usr/bin/udpgate
13 if [ -f /etc/sysconfig/udpgate ] ; then
14         . /etc/sysconfig/udpgate
15 fi
16
17 prog="udpgate"
18
19 start() {
20         echo -n $"Starting $prog: " 
21         daemon $LOCATION --start --port=$PORT
22         RETVAL=$?
23         echo
24         return $RETVAL
25 }
26
27 stop() {
28         echo -n $"Stopping $prog: "
29         $LOCATION --stop
30         RETVAL=$?
31         echo
32         return $RETVAL
33 }
34
35 case "$1" in
36                 start)
37                         start
38                         ;;
39                 
40                 stop)
41                         stop
42                         ;;
43                 
44                 status)
45                         status udpgate
46                         ;;
47                 restart)
48                         stop
49                         start
50                         ;;
51                 condrestart)
52                         if test "x`pidof udpgate`" != x; then
53                                 stop
54                                 start
55                         fi
56                         ;;
57                 
58                 *)
59                         echo $"Usage: $0 {start|stop|restart|condrestart|status}"
60                         exit 1
61
62 esac
63
64 exit $RETVAL