wok-stable view distcc/stuff/distccd @ rev 10895
get-wakoopa: update wakoop to v2.0-2
author | Liu Peng <rocky@slitaz.org> |
---|---|
date | Thu Jul 07 05:59:46 2011 +0000 (2011-07-07) |
parents | |
children | 6cf4a602d2f2 |
line source
1 #!/bin/sh
2 # /etc/init.d/distccd: Start, stop and restart Distcc daemon on SliTaz,
3 # at boot time or with the command line. Daemons options are configured
4 # with /etc/daemons.conf
5 #
6 . /etc/init.d/rc.functions
7 . /etc/daemons.conf
9 get_hosts_list()
10 {
11 if [ -s /etc/distcc/hosts.allow ]; then
12 for i in $(cat /etc/distcc/clients.allow); do
13 ( echo $i | grep -q '^#' ) && continue
14 ALLOW_HOST="$ALLOW_HOST --allow $i"
15 done
16 else
17 ALLOW_HOST="--allow 127.0.0.1"
18 fi
19 echo $ALLOW_HOST
20 }
22 NAME=Distccd
23 DESC="Distcc daemon"
24 DAEMON="/usr/bin/distccd"
25 LOGFILE="/var/log/distccd/distccd.log"
26 PIDFILE="/var/run/distccd/distccd.pid"
27 ALLOW="$(get_hosts_list)"
28 JOB=4
29 OPTIONS="--daemon --verbose -j $JOB $ALLOW --pid-file $PIDFILE --log-file $LOGFILE"
31 case "$1" in
32 start)
33 if [ -f $PIDFILE ] ; then
34 echo "$NAME already running."
35 exit 1
36 fi
37 echo -n "Starting $DESC: $NAME... "
38 $DAEMON $OPTIONS
39 status
40 ;;
41 stop)
42 if [ ! -f $PIDFILE ] ; then
43 echo "$NAME is not running."
44 exit 1
45 fi
46 echo -n "Stopping $DESC: $NAME... "
47 kill -15 $(cat $PIDFILE)
48 status
49 ;;
50 restart)
51 if [ ! -f $PIDFILE ] ; then
52 echo "$NAME is not running."
53 exit 1
54 fi
55 echo -n "Restarting $DESC: $NAME... "
56 $DAEMON $OPTIONS -k restart
57 status
58 ;;
59 *)
60 echo ""
61 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
62 echo ""
63 exit 1
64 ;;
65 esac
67 exit 0