1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
#! /bin/sh
#
# Copyright (C) 2002 C. Brandon Forehand
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# /etc/init.d/distcc
#
# and symbolic link
#
# /usr/sbin/rcdistcc
#
### BEGIN INIT INFO
# Provides: distccd
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: Start the distcc daemon
### END INIT INFO
. /etc/rc.status
. /etc/rc.config
# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}
DISTCC=/usr/local/bin/distccd
DISTCC_OPTS=--daemon
DISTCC_USER=daemon
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
# First reset status of this service
rc_reset
case "$1" in
start)
echo -n "Starting distcc daemon"
## Start daemon with startproc(8). If this fails
## the echo return value is set appropriate.
startproc -u $DISTCC_USER $DISTCC $DISTCC_OPTS
# Remember status and be verbose
rc_status -v
;;
stop)
echo -n "Shutting down distcc daemon:"
## Stop daemon with killproc(8) and if this fails
## set echo the echo return value.
killproc -TERM $DISTCC
# Remember status and be verbose
rc_status -v
;;
restart)
## If first returns OK call the second, if first or
## second command fails, set echo return value.
$0 stop && $0 start
# Remember status and be quiet
rc_status
;;
reload)
$0 restart
# Remember status and be verbose
rc_status -v
;;
status)
echo -n "Checking for service distccd: "
checkproc $DISTCC && echo OK || echo No process
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload}"
exit 1
;;
esac
rc_exit
|