121 lines
3.6 KiB
Plaintext
121 lines
3.6 KiB
Plaintext
|
#! /bin/sh
|
||
|
# Copyright (c) 2003 SuSE Linux AG Nuernberg, Germany.
|
||
|
#
|
||
|
# Author: Stephan Kulow <http://www.suse.de/feedback>
|
||
|
#
|
||
|
# Modified for openmamba by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||
|
#
|
||
|
### BEGIN INIT INFO
|
||
|
# Provides: icecream
|
||
|
# Required-Start: $network $syslog $remote_fs
|
||
|
# Required-Stop: $network $remote_fs
|
||
|
# Default-Start: 3 5
|
||
|
# Default-Stop:
|
||
|
# Description: distributed compiler daemon
|
||
|
# Short-Description: icecc
|
||
|
### END INIT INFO
|
||
|
#
|
||
|
# chkconfig: 35 98 2
|
||
|
# description: Distributed compiler daemon
|
||
|
#
|
||
|
# Determine the base and follow a runlevel link name.
|
||
|
base=${0##*/}
|
||
|
link=${base#*[SK][0-9][0-9]}
|
||
|
|
||
|
# Force execution if not called by a runlevel directory.
|
||
|
test -x /usr/sbin/iceccd || exit 0
|
||
|
|
||
|
. /etc/init.d/functions
|
||
|
. /etc/sysconfig/icecream
|
||
|
|
||
|
case "$1" in
|
||
|
start)
|
||
|
echo -n "Starting Distributed Compiler Daemon"
|
||
|
netname=
|
||
|
if test -n "$ICECREAM_NETNAME"; then
|
||
|
netname="-n $ICECREAM_NETNAME"
|
||
|
fi
|
||
|
if test "$ICECREAM_RUN_SCHEDULER" == "yes"; then
|
||
|
logfile=""
|
||
|
if test -z "$ICECREAM_SCHEDULER_LOG_FILE"; then
|
||
|
ICECREAM_SCHEDULER_LOG_FILE="/var/log/icecc_scheduler"
|
||
|
fi
|
||
|
logfile="-l $ICECREAM_SCHEDULER_LOG_FILE"
|
||
|
: > $ICECREAM_SCHEDULER_LOG_FILE
|
||
|
chown icecc:icecc $ICECREAM_SCHEDULER_LOG_FILE
|
||
|
daemon --user icecc /usr/sbin/icecc-scheduler -d $logfile $netname
|
||
|
fi
|
||
|
logfile=""
|
||
|
if test -n "$ICECREAM_LOG_FILE"; then
|
||
|
touch $ICECREAM_LOG_FILE
|
||
|
chown icecc:icecc $ICECREAM_LOG_FILE
|
||
|
logfile="-l $ICECREAM_LOG_FILE"
|
||
|
else
|
||
|
touch /var/log/iceccd
|
||
|
chown icecc:icecc /var/log/iceccd
|
||
|
fi
|
||
|
nice=
|
||
|
if test -n "$ICECREAM_NICE_LEVEL"; then
|
||
|
nice="--nice $ICECREAM_NICE_LEVEL"
|
||
|
fi
|
||
|
scheduler=
|
||
|
if test -n "$ICECREAM_SCHEDULER_HOST"; then
|
||
|
scheduler="-s $ICECREAM_SCHEDULER_HOST"
|
||
|
fi
|
||
|
noremote=
|
||
|
if test "$ICECREAM_ALLOW_REMOTE" = "no" 2> /dev/null; then
|
||
|
noremote="--no-remote"
|
||
|
fi
|
||
|
maxjobs=
|
||
|
if test -n "$ICECREAM_MAX_JOBS"; then
|
||
|
if test "$ICECREAM_MAX_JOBS" -eq 0 2> /dev/null; then
|
||
|
maxjobs="-m 1"
|
||
|
noremote="--no-remote"
|
||
|
else
|
||
|
maxjobs="-m $ICECREAM_MAX_JOBS"
|
||
|
fi
|
||
|
fi
|
||
|
loadproc /usr/sbin/iceccd -d $logfile $nice $scheduler $netname -u icecc -b "$ICECREAM_BASEDIR/environments" $maxjobs $noremote
|
||
|
evaluate_retval; echo
|
||
|
;;
|
||
|
stop)
|
||
|
echo -n "Shutting down Distributed Compiler Daemon"
|
||
|
killproc /usr/sbin/iceccd TERM
|
||
|
if test "$ICECREAM_RUN_SCHEDULER" == "yes"; then
|
||
|
killproc /usr/sbin/icecc-scheduler TERM
|
||
|
fi
|
||
|
evaluate_retval; echo
|
||
|
;;
|
||
|
restart)
|
||
|
## If first returns OK call the second, if first or
|
||
|
## second command fails, set echo return value.
|
||
|
$0 stop; sleep 1 && $0 start
|
||
|
;;
|
||
|
try-restart|condrestart)
|
||
|
## Do a restart only if the service was active before.
|
||
|
## Note: try-restart is now part of LSB (as of 1.9).
|
||
|
## RH has a similar command named condrestart.
|
||
|
if test "$1" = "condrestart"; then
|
||
|
echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
|
||
|
fi
|
||
|
$0 status
|
||
|
if test $? = 0; then
|
||
|
$0 restart
|
||
|
fi
|
||
|
;;
|
||
|
reload|force-reload)
|
||
|
if test "$ICECREAM_RUN_SCHEDULER" == "yes"; then
|
||
|
killproc -HUP /usr/sbin/scheduler
|
||
|
fi
|
||
|
killproc -HUP /usr/sbin/iceccd
|
||
|
;;
|
||
|
status)
|
||
|
echo -n "Checking for Distributed Compiler Daemon: "
|
||
|
statusproc /usr/sbin/iceccd
|
||
|
;;
|
||
|
*)
|
||
|
echo "Usage: $0 {start|stop|status|restart|try-restart|reload}"
|
||
|
exit 1
|
||
|
;;
|
||
|
esac
|