]> git.pld-linux.org Git - packages/func.git/blob - func-funcd.init
- up to 0.21
[packages/func.git] / func-funcd.init
1 #!/bin/sh
2 #
3 # funcd funcd short service description
4 #
5 # chkconfig:    - 98 2
6 #
7 # description:  funcd long service description
8 #
9 # $Id$
10
11 # Source function library
12 . /etc/rc.d/init.d/functions
13
14 # Get network config
15 . /etc/sysconfig/network
16
17 # Get service config - may override defaults
18 [ -f /etc/sysconfig/funcd ] && . /etc/sysconfig/funcd
19
20 # Check that networking is up.
21 if is_yes "${NETWORKING}"; then
22         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
23                 msg_network_down funcd
24                 exit 1
25         fi
26 else
27         exit 0
28 fi
29
30 start() {
31         # Check if the service is already running?
32         if [ ! -f /var/lock/subsys/funcd ]; then
33                 msg_starting funcd
34                 daemon /usr/bin/funcd --daemon
35                 RETVAL=$?
36                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/funcd
37         else
38                 msg_already_running funcd
39         fi
40 }
41
42 stop() {
43         if [ -f /var/lock/subsys/funcd ]; then
44                 # Stop daemons.
45                 msg_stopping funcd
46                 killproc --pidfile /var/run/funcd.pid funcd -TERM
47                 rm -f /var/lock/subsys/funcd
48         else
49                 msg_not_running funcd
50         fi
51 }
52
53 condrestart() {
54         if [ -f /var/lock/subsys/funcd ]; then
55                 stop
56                 start
57         else
58                 if [ $1 -ne 0 ]; then
59                         msg_not_running funcd
60                 fi
61                 RETVAL=$1
62         fi
63 }
64
65 RETVAL=0
66 # See how we were called.
67 case "$1" in
68   start)
69         start
70         ;;
71   stop)
72         stop
73         ;;
74   restart)
75         stop
76         start
77         ;;
78   try-restart)
79         condrestart 0
80         ;;
81   force-reload)
82         condrestart 7
83         ;;
84   status)
85         status funcd
86         RETVAL=$?
87         ;;
88   *)
89         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
90         exit 3
91 esac
92
93 exit $RETVAL
This page took 0.085824 seconds and 3 git commands to generate.