Added some frustrated comments.
[doldaconnect.git] / contrib / fedora-init.d-doldacond
1 #!/bin/sh
2 # Stolen from PLD Linux
3 #
4 # doldacond:    Direct Connect client as daemon
5 #
6 #
7 # chkconfig:    345 91 09
8 # description:  doldacond
9 #
10 # config:       /etc/sysconfig/doldacond
11
12 # Source function library
13 . /etc/rc.d/init.d/functions
14
15 # Get service config
16 if [ -f /etc/sysconfig/doldacond ]; then
17         . /etc/sysconfig/doldacond
18 fi
19
20 # Check that networking is up.
21 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
22         msg_network_down doldacon
23         exit 1
24 fi
25
26 # See how we were called.
27 case "$1" in
28         start)
29                 # Check if service is already running?
30                 if [ ! -f /var/lock/subsys/doldacond ]; then
31                         msg_starting doldacond
32                         daemon doldacond -C /etc/doldaconnect/doldacond.conf -p /var/run/doldacond.pid ${ADD_OPT}
33                         RETVAL=$?
34                         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/doldacond
35                 else
36                         msg_already_running doldacond
37                 fi
38                 ;;
39         stop)
40                 if [ -f /var/lock/subsys/doldacond ]; then
41                         msg_stopping doldacond
42                         killproc --pidfile /var/run/doldacond.pid doldacond
43                         rm -f /var/lock/subsys/doldacond
44                 else
45                         msg_not_running doldacond
46                 fi
47                 ;;
48         status)
49                 status doldacond
50                 RESULT=$?
51                 ;;
52         reload)
53                 if [ -f /var/lock/subsys/doldacond ]; then
54                         msg_reloading doldacond
55                         killproc --pidfile /var/run/doldacond.pid doldacond -HUP
56                         RETVAL=$?
57                 else
58                         msg_not_running doldacond
59                         exit 7
60                 fi
61                 ;;
62         restart|force-reload)
63                 $0 stop
64                 $0 start
65                 ;;
66         *)
67                 msg_usage "$0 {start|stop|restart|force-reload|status}"
68                 exit 3
69 esac
70
71 exit 0