Debian Codegraph @

suse/init.icecream

raw
1 #! /bin/sh
2 # Copyright (c) 2003 SuSE Linux AG Nuernberg, Germany.
3 #
4 # Author: Stephan Kulow <http://www.suse.de/feedback>
5 #
6 # /etc/init.d/icecream
7 # and its symbolic link
8 # /usr/sbin/rcicecream
9 #
10 ### BEGIN INIT INFO
11 # Provides: icecream
12 # Required-Start: $network $syslog $remote_fs
13 # Required-Stop: $network $remote_fs
14 # Default-Start: 3 5
15 # Default-Stop:
16 # Description: distributed compiler daemon
17 # Short-Description: icecc
18 ### END INIT INFO
19
20 # Determine the base and follow a runlevel link name.
21 base=${0##*/}
22 link=${base#*[SK][0-9][0-9]}
23
24 # Force execution if not called by a runlevel directory.
25 test -x /usr/sbin/iceccd || exit 0
26
27 . /etc/rc.status
28 . /etc/sysconfig/icecream
29
30 rc_reset
31 case "$1" in
32 start)
33 echo -n "Starting Distributed Compiler Daemon"
34 netname=
35 if test -n "$ICECREAM_NETNAME"; then
36 netname="-n $ICECREAM_NETNAME"
37 fi
38 if test "$ICECREAM_RUN_SCHEDULER" == "yes"; then
39 logfile=""
40 if test -z "$ICECREAM_SCHEDULER_LOG_FILE"; then
41 ICECREAM_SCHEDULER_LOG_FILE="/var/log/icecream/scheduler"
42 fi
43 logfile="-l $ICECREAM_SCHEDULER_LOG_FILE"
44 : > $ICECREAM_SCHEDULER_LOG_FILE
45 chown icecream:icecream $ICECREAM_SCHEDULER_LOG_FILE
46 startproc -u icecream /usr/sbin/icecc-scheduler -d $logfile $netname
47 fi
48 logfile=""
49 if test -n "$ICECREAM_LOG_FILE"; then
50 touch $ICECREAM_LOG_FILE
51 chown icecream:icecream $ICECREAM_LOG_FILE
52 logfile="-l $ICECREAM_LOG_FILE"
53 else
54 touch /var/log/icecream/iceccd
55 chown icecream:icecream /var/log/icecream/iceccd
56 fi
57 nice=
58 if test -n "$ICECREAM_NICE_LEVEL"; then
59 nice="--nice $ICECREAM_NICE_LEVEL"
60 fi
61 scheduler=
62 if test -n "$ICECREAM_SCHEDULER_HOST"; then
63 scheduler="-s $ICECREAM_SCHEDULER_HOST"
64 fi
65 noremote=
66 if test "$ICECREAM_ALLOW_REMOTE" = "no" 2> /dev/null; then
67 noremote="--no-remote"
68 fi
69 maxjobs=
70 if test -n "$ICECREAM_MAX_JOBS"; then
71 if test "$ICECREAM_MAX_JOBS" -eq 0 2> /dev/null; then
72 maxjobs="-m 1"
73 noremote="--no-remote"
74 else
75 maxjobs="-m $ICECREAM_MAX_JOBS"
76 fi
77 fi
78 startproc /usr/sbin/iceccd -d $logfile $nice $scheduler $netname -u icecream -b "$ICECREAM_BASEDIR" $maxjobs $noremote
79 rc_status -v
80 ;;
81 stop)
82 echo -n "Shutting down Distributed Compiler Daemon"
83 killproc -TERM /usr/sbin/iceccd
84 if test "$ICECREAM_RUN_SCHEDULER" == "yes"; then
85 killproc -TERM /usr/sbin/icecc-scheduler
86 fi
87 rc_status -v
88 ;;
89 restart)
90 ## If first returns OK call the second, if first or
91 ## second command fails, set echo return value.
92 $0 stop; sleep 1 && $0 start
93 rc_status
94 ;;
95 try-restart|condrestart)
96 ## Do a restart only if the service was active before.
97 ## Note: try-restart is now part of LSB (as of 1.9).
98 ## RH has a similar command named condrestart.
99 if test "$1" = "condrestart"; then
100 echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
101 fi
102 $0 status
103 if test $? = 0; then
104 $0 restart
105 else
106 rc_reset # Not running is not a failure.
107 fi
108 # Remember status and be quiet
109 rc_status
110 ;;
111 reload|force-reload)
112 if test "$ICECREAM_RUN_SCHEDULER" == "yes"; then
113 killproc -HUP /usr/sbin/icecc-scheduler
114 fi
115 killproc -HUP /usr/sbin/iceccd
116 rc_status
117 ;;
118 status)
119 echo -n "Checking for Distributed Compiler Daemon: "
120 checkproc /usr/sbin/iceccd
121 rc_status -v
122 ;;
123 *)
124 echo "Usage: $0 {start|stop|status|restart|try-restart|reload}"
125 exit 1
126 ;;
127 esac
128 rc_exit