~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to utopic/etc/init.d/icecc-scheduler

  • Committer: Dimitri John Ledkov
  • Date: 2014-11-19 12:58:41 UTC
  • Revision ID: dimitri.j.ledkov@intel.com-20141119125841-98dr37roy8dvcv3b
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
### BEGIN INIT INFO
3
 
# Provides:          icecc-scheduler
4
 
# Required-Start:    $local_fs $remote_fs
5
 
# Required-Stop:     $local_fs $remote_fs
6
 
# Default-Start:     2 3 4 5
7
 
# Default-Stop:      0 1 6
8
 
# Short-Description: control icecc scheduler start at boot time
9
 
# Description:       control icecc scheduler start at boot time by
10
 
#                    sourcing /etc/default/icecc and /etc/icecc/icecc.conf.
11
 
### END INIT INFO
12
 
 
13
 
SCHEDULER=/usr/sbin/icecc-scheduler
14
 
CONFIGFILE=/etc/icecc/icecc.conf
15
 
DEFAULTFILE=/etc/default/icecc
16
 
 
17
 
# Read configuration files
18
 
[ -r $CONFIGFILE ] && . $CONFIGFILE
19
 
[ -r $DEFAULTFILE ] && . $DEFAULTFILE
20
 
 
21
 
test -x $SCHEDULER || exit 0
22
 
 
23
 
. /lib/lsb/init-functions
24
 
 
25
 
netname=
26
 
if test -n "$ICECC_NETNAME"; then
27
 
        netname="-n $ICECC_NETNAME"
28
 
fi
29
 
 
30
 
start_icecc_scheduler() {
31
 
        if test -z "$ICECC_SCHEDULER_LOG_FILE"; then
32
 
                ICECC_SCHEDULER_LOG_FILE="/var/log/icecc_scheduler"
33
 
        fi
34
 
 
35
 
        logfile="-l $ICECC_SCHEDULER_LOG_FILE"
36
 
        : > $ICECC_SCHEDULER_LOG_FILE
37
 
        chown icecc $ICECC_SCHEDULER_LOG_FILE
38
 
        start-stop-daemon --start --quiet --chuid icecc \
39
 
        --exec $SCHEDULER -- -d $logfile $netname
40
 
}
41
 
 
42
 
stop_icecc_scheduler() {
43
 
        start-stop-daemon --stop --quiet --signal TERM --oknodo --exec $SCHEDULER
44
 
}
45
 
 
46
 
case "$1" in
47
 
  start)
48
 
        log_daemon_msg "Starting distributed compiler scheduler" "icecc-scheduler"
49
 
        start_icecc_scheduler
50
 
        log_end_msg $?
51
 
        ;;
52
 
  stop)
53
 
        log_daemon_msg "Stopping distributed compiler scheduler" "icecc_scheduler"
54
 
        stop_icecc_scheduler
55
 
        log_end_msg $?
56
 
        ;;
57
 
  restart|force-reload)
58
 
        log_daemon_msg "Restarting distributed compiler scheduler" "icecc-scheduler"
59
 
        stop_icecc_scheduler
60
 
        sleep 1
61
 
        start_icecc_scheduler
62
 
        log_end_msg $?
63
 
        ;;
64
 
  status)
65
 
        status_of_proc "$SCHEDULER" "icecc-scheduler" && exit 0 || exit $?
66
 
        ;;
67
 
  *)
68
 
        N=/etc/init.d/icecc-scheduler
69
 
        echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
70
 
        exit 1
71
 
        ;;
72
 
esac
73
 
 
74
 
exit 0
75