#!/bin/sh
#
# icecc-scheduler: Distributed compiler scheduler
#
# chkconfig: - 98 02
# description: This is a daemon which schedules compilation jobs to \
# networked machines running iceccd.
#
### BEGIN INIT INFO
# Provides: icecc-scheduler
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Short-Description: Start/stop Icecream scheduler
# Description: Start / stop the scheduler for Icecream distributed compilers
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
exec=/usr/sbin/icecc-scheduler
service=icecc-scheduler
config=/etc/sysconfig/icecream
[ -e $config ] && . $config
lockfile=/var/lock/subsys/icecc-scheduler
start() {
[ -x $exec ] || exit 5
[ -f $config ] || exit 6
echo -n $"Starting distributed compiler scheduler: "
params=""
if [ -n "$ICECREAM_NETNAME" ] ; then
params="$params -n $ICECREAM_NETNAME"
fi
logfile=${ICECREAM_SCHEDULER_LOG_FILE:-/var/log/icecc-scheduler}
params="$params -l $logfile"
# touch "$logfile"
# chown icecream:icecream $logfile
daemon --user icecream --check $service $exec -d $params
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $lockfile
return $RETVAL
}
stop() {
echo -n $"Stopping distributed compiler scheduler: "
killproc $service
RETVAL=$?
echo
if [ $RETVAL -eq 0 ]; then
rm -f $lockfile
fi
return $RETVAL
}
restart() {
stop
start
}
reload() {
restart
}
force_reload() {
restart
}
rh_status() {
status $service
}
rh_status_q() {
rh_status > /dev/null 2>&1
}
# See how we were called.
case "$1" in
start)
rh_status_q && exit 0
start
;;
stop)
rh_status_q || exit 0
stop
;;
status)
rh_status
;;
restart)
restart
;;
reload)
rh_status_q || exit 7
reload
;;
force-reload)
force_reload
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}"
exit 2
esac
exit $?