wok view distcc/stuff/distccd @ rev 18020

Up rp-pppoe (3.11)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat May 02 22:46:46 2015 +0200 (2015-05-02)
parents 6cf4a602d2f2
children 7f188676b59c
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 if [ ! -d /var/run/distccd ]; then
32 mkdir -p /var/run/distccd
33 chown distccd.distccd /var/run/distccd
34 fi
35 case "$1" in
36 start)
37 if active_pidfile $PIDFILE distccd ; then
38 echo "$NAME already running."
39 exit 1
40 fi
41 echo -n "Starting $DESC: $NAME... "
42 $DAEMON $OPTIONS
43 status
44 ;;
45 stop)
46 if ! active_pidfile $PIDFILE distccd ; then
47 echo "$NAME is not running."
48 exit 1
49 fi
50 echo -n "Stopping $DESC: $NAME... "
51 kill -15 $(cat $PIDFILE)
52 status
53 ;;
54 restart)
55 if ! active_pidfile $PIDFILE distccd ; then
56 echo "$NAME is not running."
57 exit 1
58 fi
59 echo -n "Restarting $DESC: $NAME... "
60 $DAEMON $OPTIONS -k restart
61 status
62 ;;
63 *)
64 echo ""
65 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
66 echo ""
67 exit 1
68 ;;
69 esac
71 exit 0