]>
Commit | Line | Data |
---|---|---|
7d3267c9 AM |
1 | #!/bin/sh |
2 | # | |
3 | # cactid cactid | |
4 | # | |
5 | # chkconfig: 345 55 45 | |
6 | # | |
7 | # description: cactid - data gathering daemon for cacti | |
8 | ||
9 | ||
10 | # Source function library | |
11 | . /etc/rc.d/init.d/functions | |
12 | ||
13 | # Get network config | |
14 | . /etc/sysconfig/network | |
15 | ||
16 | # Get service config | |
17 | [ -f /etc/sysconfig/cactid ] && . /etc/sysconfig/cactid | |
18 | ||
19 | # Check that networking is up. | |
20 | if is_yes "${NETWORKING}"; then | |
21 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status -a "$1" != init ]; then | |
22 | msg_network_down cactid | |
23 | exit 1 | |
24 | fi | |
25 | else | |
26 | exit 0 | |
27 | fi | |
28 | ||
29 | RETVAL=0 | |
30 | # See how we were called. | |
31 | case "$1" in | |
32 | start) | |
33 | # Check if the service is already running? | |
34 | if [ ! -f /var/lock/subsys/cactid ]; then | |
35 | msg_starting cactid | |
36 | daemon /usr/sbin/cactid | |
37 | RETVAL=$? | |
38 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cactid | |
39 | else | |
40 | msg_already_running cactid | |
41 | fi | |
42 | ;; | |
43 | stop) | |
44 | if [ -f /var/lock/subsys/cactid ]; then | |
45 | msg_stopping cactid | |
46 | killproc cactid -TERM | |
47 | rm -f /var/lock/subsys/cactid >/dev/null 2>&1 | |
48 | else | |
49 | msg_not_running cactid | |
50 | fi | |
51 | ;; | |
52 | restart) | |
53 | $0 stop | |
54 | $0 start | |
55 | exit $? | |
56 | ;; | |
57 | status) | |
58 | status cactid | |
59 | exit $? | |
60 | ;; | |
61 | reload|force-reload) | |
62 | if [ -f /var/lock/subsys/cactid ]; then | |
63 | msg_reloading cactid | |
64 | killproc cactid -HUP | |
65 | RETVAL=$? | |
66 | else | |
67 | msg_not_running cactid >&2 | |
68 | exit 7 | |
69 | fi | |
70 | ;; | |
71 | *) | |
72 | msg_usage "$0 {start|stop|init|restart|reload|force-reload|status}" | |
73 | exit 3 | |
74 | esac | |
75 | ||
76 | exit $RETVAL |