updated on Wed Jan 18 08:00:29 UTC 2012
[aur-mirror.git] / icecream1 / icecream-daemon
blob1bab340676fe8816ba14150df357856c8d9dad85
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
5 . /etc/icecream.conf
7 case "$1" in
8 start)
9 stat_busy "Starting Icecream Daemon"
10 netname=
11 if test -n "$ICECREAM_NETNAME"; then
12 netname="-n $ICECREAM_NETNAME"
14 logfile=""
15 if test -n "$ICECREAM_LOG_FILE"; then
16 touch $ICECREAM_LOG_FILE
17 logfile="-l $ICECREAM_LOG_FILE"
19 nice=
20 if test -n "$ICECREAM_NICE_LEVEL"; then
21 nice="--nice $ICECREAM_NICE_LEVEL"
23 scheduler=
24 if test -n "$ICECREAM_SCHEDULER_HOST"; then
25 scheduler="-s $ICECREAM_SCHEDULER_HOST"
27 noremote=
28 if test "$ICECREAM_ALLOW_REMOTE" = "no" 2> /dev/null; then
29 noremote="--no-remote"
31 maxjobs=
32 if test -n "$ICECREAM_MAX_JOBS"; then
33 if test "$ICECREAM_MAX_JOBS" -eq 0 2> /dev/null; then
34 maxjobs="-m 1"
35 noremote="--no-remote"
36 else
37 maxjobs="-m $ICECREAM_MAX_JOBS"
40 /opt/icecream/sbin/iceccd -d $logfile $nice $netname -b "$ICECREAM_BASEDIR" $maxjobs $noremote &>/dev/null
41 if [ $? -gt 0 ]; then
42 stat_fail
43 else
44 add_daemon icecream
45 stat_done
48 stop)
49 stat_busy "Stopping Icecream Daemon"
50 killall /opt/icecream/sbin/iceccd > /dev/null 2>&1 || true
51 if [ $? -gt 0 ]; then
52 stat_fail
53 else
54 rm_daemon icecream
55 stat_done
58 restart)
59 $0 stop
60 sleep 1
61 $0 start
64 echo "usage: $0 {start|stop|restart}"
65 esac
66 exit 0