]>
Commit | Line | Data |
---|---|---|
4cc12bee PZ |
1 | #!/bin/sh |
2 | # | |
b248ed43 | 3 | # funcd funcd short service description |
4cc12bee | 4 | # |
b248ed43 | 5 | # chkconfig: - 98 2 |
4cc12bee | 6 | # |
b248ed43 PZ |
7 | # description: funcd long service description |
8 | # | |
9 | # $Id$ | |
4cc12bee | 10 | |
b248ed43 | 11 | # Source function library |
4cc12bee PZ |
12 | . /etc/rc.d/init.d/functions |
13 | ||
b248ed43 PZ |
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() { | |
4cc12bee PZ |
31 | # Check if the service is already running? |
32 | if [ ! -f /var/lock/subsys/funcd ]; then | |
b248ed43 | 33 | msg_starting funcd |
adc8b026 | 34 | daemon /usr/bin/funcd --daemon |
4cc12bee PZ |
35 | RETVAL=$? |
36 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/funcd | |
37 | else | |
b248ed43 | 38 | msg_already_running funcd |
4cc12bee | 39 | fi |
b248ed43 PZ |
40 | } |
41 | ||
42 | stop() { | |
4cc12bee | 43 | if [ -f /var/lock/subsys/funcd ]; then |
b248ed43 PZ |
44 | # Stop daemons. |
45 | msg_stopping funcd | |
b248ed43 | 46 | killproc --pidfile /var/run/funcd.pid funcd -TERM |
4cc12bee PZ |
47 | rm -f /var/lock/subsys/funcd |
48 | else | |
b248ed43 | 49 | msg_not_running funcd |
4cc12bee | 50 | fi |
b248ed43 PZ |
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 | |
4cc12bee PZ |
83 | ;; |
84 | status) | |
85 | status funcd | |
b248ed43 | 86 | RETVAL=$? |
4cc12bee PZ |
87 | ;; |
88 | *) | |
b248ed43 | 89 | msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}" |
4cc12bee PZ |
90 | exit 3 |
91 | esac | |
92 | ||
93 | exit $RETVAL |