forked from autotest/autotest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautotest.init
executable file
·61 lines (49 loc) · 1.12 KB
/
autotest.init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh
# autotest control init script, intended for Debian/Ubuntu type boxes.
#
# copy this to /etc/init.d/autotest, then run this:
#
# update-rc.d autotest start 95 2 3 4 5 . stop 90 0 1 6 .
BASE_DIR=/usr/local/autotest
BECOME_USER=autotest
if (test -r /lib/lsb/init-functions)
then
. /lib/lsb/init-functions
else
echo "This script requires /lib/lsb/init-functions"
exit 1
fi
# ---
autotest_start() {
cd /tmp
log_daemon_msg "Starting autotest-scheduler-watcher"
( ulimit -v 2048000 ; \
start-stop-daemon --start --quiet --chuid $BECOME_USER \
--background --exec $BASE_DIR/scheduler/autotest-scheduler-watcher )
}
stop_daemon() {
PID_NAME=$1
DAEMON_NAME=$2
log_daemon_msg "Stopping autotest $DAEMON_NAME"
start-stop-daemon --stop --quiet --pidfile $BASE_DIR/$PID_NAME.pid
}
autotest_stop() {
stop_daemon autotest-scheduler-watcher scheduler-watcher
stop_daemon autotest-scheduler scheduler
}
case "$1" in
start)
autotest_start
;;
stop)
autotest_stop
;;
restart)
autotest_stop
sleep 2
autotest_start
;;
*)
echo "Usage: $0 start|stop|restart"
exit 1
esac