]>
Commit | Line | Data |
---|---|---|
af2038cb | 1 | #!/bin/sh |
2 | # | |
3 | # $Id$ | |
4 | # | |
a269e88d | 5 | # distccd distccd |
af2038cb | 6 | # |
7 | # chkconfig: 345 55 45 | |
8 | # | |
a269e88d ER |
9 | # description: distccd |
10 | # | |
af2038cb | 11 | |
12 | # Source function library | |
13 | . /etc/rc.d/init.d/functions | |
14 | ||
15 | # Get network config | |
16 | . /etc/sysconfig/network | |
17 | ||
18 | # Get service config | |
19 | [ -f /etc/sysconfig/distccd ] && . /etc/sysconfig/distccd | |
20 | ||
21 | # Check that networking is up. | |
15183f89 | 22 | if is_yes "${NETWORKING}"; then |
4fd1bfd6 | 23 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then |
15183f89 | 24 | msg_network_down distccd |
25 | exit 1 | |
26 | fi | |
27 | else | |
28 | exit 0 | |
af2038cb | 29 | fi |
30 | ||
5e3c85f3 | 31 | [ -z "$DISTCC_HOSTS_ALLOW" -a -n "$HOSTS_ALLOW" ] && DISTCC_HOSTS_ALLOW="$HOSTS_ALLOW" |
a269e88d | 32 | |
391a11cf | 33 | RETVAL=0 |
af2038cb | 34 | # See how we were called. |
35 | case "$1" in | |
36 | start) | |
37 | # Check if the service is already running? | |
38 | if [ ! -f /var/lock/subsys/distccd ]; then | |
39 | msg_starting distccd | |
a269e88d ER |
40 | touch distcc /var/log/distcc |
41 | chown distcc /var/log/distcc | |
f0ea67d4 | 42 | daemon /usr/bin/distccd --daemon --user distcc --log-file /var/log/distcc `for ip in $DISTCC_HOSTS_ALLOW; do echo -n "--allow $ip "; done` $DISTCC_OPTS |
af2038cb | 43 | RETVAL=$? |
a269e88d | 44 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/distccd |
af2038cb | 45 | else |
46 | msg_already_running distccd | |
47 | fi | |
48 | ;; | |
49 | stop) | |
15183f89 | 50 | if [ -f /var/lock/subsys/distccd ]; then |
af2038cb | 51 | msg_stopping distccd |
52 | killproc distccd | |
53 | rm -f /var/run/distccd.pid /var/lock/subsys/distccd >/dev/null 2>&1 | |
54 | else | |
55 | msg_not_running distccd | |
a269e88d | 56 | fi |
af2038cb | 57 | ;; |
58 | restart) | |
59 | $0 stop | |
60 | $0 start | |
391a11cf | 61 | exit $? |
af2038cb | 62 | ;; |
63 | status) | |
64 | status distccd | |
65 | exit $? | |
66 | ;; | |
15183f89 | 67 | reload|force-reload) |
68 | if [ -f /var/lock/subsys/distccd ]; then | |
69 | msg_reloading distccd | |
70 | killproc distccd -HUP | |
71 | RETVAL=$? | |
72 | else | |
32c31df2 | 73 | msg_not_running distccd >&2 |
391a11cf | 74 | exit 7 |
15183f89 | 75 | fi |
af2038cb | 76 | ;; |
77 | *) | |
15183f89 | 78 | msg_usage "$0 {start|stop|restart|reload|force-reload|status}" |
391a11cf | 79 | exit 3 |
af2038cb | 80 | esac |
81 | ||
82 | exit $RETVAL | |
83 | ||
84 | # This must be last line ! | |
a269e88d | 85 | # vi:syntax=sh:tw=78:ts=4:sw=4 |