wok-current view distcc/stuff/distccd @ rev 19914
python-gammu: update bdeps
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Apr 13 15:41:26 2017 +0200 (2017-04-13) |
parents | 0d8a1a3edc72 |
children |
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="$(_ '%s daemon' Distcc)"
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 _ '%s is already running.' $NAME
39 exit 1
40 fi
41 action 'Starting %s: %s...' "$DESC" $NAME
42 $DAEMON $OPTIONS
43 status
44 ;;
45 stop)
46 if ! active_pidfile $PIDFILE distccd ; then
47 _ '%s is not running.' $NAME
48 exit 1
49 fi
50 action 'Stopping %s: %s...' "$DESC" $NAME
51 kill -15 $(cat $PIDFILE)
52 status
53 ;;
54 restart)
55 if ! active_pidfile $PIDFILE distccd ; then
56 _ '%s is not running.' $NAME
57 exit 1
58 fi
59 action 'Restarting %s: %s...' "$DESC" $NAME
60 $DAEMON $OPTIONS -k restart
61 status
62 ;;
63 *)
64 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
65 newline
66 exit 1
67 ;;
68 esac
70 exit 0