| 1 | #!/bin/sh |
| 2 | # |
| 3 | # Init file for Distccd - A distributed compilation front-end. |
| 4 | # WARNING: Don't enable on untrusted networks |
| 5 | # |
| 6 | # Written by Dag Wieers <[email protected]>. |
| 7 | # |
| 8 | # chkconfig: - 80 20 |
| 9 | # description: Distccd - distributed compilation front-end (daemon) \ |
| 10 | # WARNING: Don't enable on untrusted networks |
| 11 | # |
| 12 | # processname: distccd |
| 13 | # |
| 14 | # config: /etc/sysconfig/distccd |
| 15 | |
| 16 | source /etc/init.d/functions |
| 17 | source /etc/sysconfig/network |
| 18 | |
| 19 | ### Check that networking is up. |
| 20 | [ "${NETWORKING}" == "no" ] && exit 0 |
| 21 | |
| 22 | [ -x "/usr/bin/distccd" ] || exit 1 |
| 23 | |
| 24 | ### Default variables |
| 25 | SYSCONFIG="/etc/sysconfig/distccd" |
| 26 | OPTIONS="" |
| 27 | USER="distcc" |
| 28 | DISTCCPATH="$PATH" |
| 29 | |
| 30 | ### Read configuration |
| 31 | [ -r "$SYSCONFIG" ] && source "$SYSCONFIG" |
| 32 | |
| 33 | RETVAL=0 |
| 34 | prog="distccd" |
| 35 | desc="Distributed Compiler daemon" |
| 36 | |
| 37 | start() { |
| 38 | echo -n $"Starting $desc ($prog): " |
| 39 | PATH="$DISTCCPATH" daemon --user "$USER" $prog --daemon --log-file="/var/log/distccd.log" $OPTIONS |
| 40 | RETVAL=$? |
| 41 | echo |
| 42 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog |
| 43 | return $RETVAL |
| 44 | } |
| 45 | |
| 46 | stop() { |
| 47 | echo -n $"Shutting down $desc ($prog): " |
| 48 | killproc $prog |
| 49 | RETVAL=$? |
| 50 | echo |
| 51 | [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog |
| 52 | return $RETVAL |
| 53 | } |
| 54 | |
| 55 | restart() { |
| 56 | stop |
| 57 | start |
| 58 | } |
| 59 | |
| 60 | case "$1" in |
| 61 | start) |
| 62 | start |
| 63 | ;; |
| 64 | stop) |
| 65 | stop |
| 66 | ;; |
| 67 | restart|reload) |
| 68 | restart |
| 69 | ;; |
| 70 | condrestart) |
| 71 | [ -e /var/lock/subsys/$prog ] && restart |
| 72 | RETVAL=$? |
| 73 | ;; |
| 74 | status) |
| 75 | status $prog |
| 76 | RETVAL=$? |
| 77 | ;; |
| 78 | *) |
| 79 | echo $"Usage $0 {start|stop|restart|condrestart|status}" |
| 80 | RETVAL=1 |
| 81 | esac |
| 82 | |
| 83 | exit $RETVAL |