1 | #! /bin/sh |
---|
2 | |
---|
3 | ### BEGIN INIT INFO |
---|
4 | # Provides: torque-scheduler |
---|
5 | # Required-Start: $all |
---|
6 | # Required-Stop: $all |
---|
7 | # Should-Start: $all |
---|
8 | # Should-Stop: $all |
---|
9 | # Default-Start: 2 3 4 5 |
---|
10 | # Default-Stop: 0 1 6 |
---|
11 | # Short-Description: Start and stop the Torque scheduler |
---|
12 | # Description: PBS is a versatile batch system for SMPs and clusters. |
---|
13 | # This script controls the scheduler. |
---|
14 | ### END INIT INFO |
---|
15 | |
---|
16 | PATH=/sbin:/bin:/usr/sbin:/usr/bin |
---|
17 | DAEMON=/usr/sbin/pbs_sched |
---|
18 | NAME=torque-scheduler |
---|
19 | DESC="Torque scheduler" |
---|
20 | PIDFILE=/var/spool/torque/sched_priv/server.lock |
---|
21 | |
---|
22 | test -x $DAEMON || exit 0 |
---|
23 | |
---|
24 | # Include defaults if available |
---|
25 | if [ -f /etc/default/$NAME ] ; then |
---|
26 | . /etc/default/$NAME |
---|
27 | elif [ -f /etc/default/torque ]; then |
---|
28 | . /etc/default/torque |
---|
29 | fi |
---|
30 | |
---|
31 | # set -e cannot work, otherwise the log_end_msg will not be shown |
---|
32 | # set -e |
---|
33 | |
---|
34 | # Load lsb functions |
---|
35 | . /lib/lsb/init-functions |
---|
36 | |
---|
37 | |
---|
38 | case "$1" in |
---|
39 | start) |
---|
40 | log_begin_msg "Starting $DESC: " |
---|
41 | start-stop-daemon --start --quiet \ |
---|
42 | --pidfile $PIDFILE \ |
---|
43 | --exec $DAEMON -- $DAEMON_OPTS |
---|
44 | log_end_msg $? |
---|
45 | ;; |
---|
46 | stop) |
---|
47 | log_begin_msg "Stopping $DESC: " |
---|
48 | start-stop-daemon --stop --quiet \ |
---|
49 | --pidfile $PIDFILE \ |
---|
50 | --exec $DAEMON |
---|
51 | log_end_msg $? |
---|
52 | ;; |
---|
53 | reload) |
---|
54 | # send a SIGHUP to force scheduler to reload config file |
---|
55 | log_begin_msg "Reloading $DESC configuration files" |
---|
56 | start-stop-daemon --stop --signal 1 --quiet \ |
---|
57 | --pidfile $PIDFILE \ |
---|
58 | --exec $DAEMON |
---|
59 | log_end_msg $? |
---|
60 | ;; |
---|
61 | force-reload) |
---|
62 | # check whether $DAEMON is running. If so, restart |
---|
63 | start-stop-daemon --stop --test --quiet \ |
---|
64 | --pidfile $PIDFILE \ |
---|
65 | --exec $DAEMON \ |
---|
66 | && $0 restart \ |
---|
67 | || exit 0 |
---|
68 | ;; |
---|
69 | restart) |
---|
70 | log_begin_msg "Restarting $DESC: " |
---|
71 | start-stop-daemon --stop --quiet \ |
---|
72 | --pidfile $PIDFILE \ |
---|
73 | --exec $DAEMON |
---|
74 | sleep 1 |
---|
75 | start-stop-daemon --start --quiet \ |
---|
76 | --pidfile $PIDFILE \ |
---|
77 | --exec $DAEMON -- $DAEMON_OPTS |
---|
78 | log_end_msg $? |
---|
79 | ;; |
---|
80 | *) |
---|
81 | N=/etc/init.d/`basename $0` |
---|
82 | log_success_msg "Usage: $N {start|stop|restart|force-reload}" |
---|
83 | exit 1 |
---|
84 | ;; |
---|
85 | esac |
---|
86 | |
---|
87 | exit 0 |
---|