blob: 78ed9a86fe40f69c0f5af6d73e8409ceb73073b1 [file] [log] [blame]
mblighabd7e482009-09-04 16:32:45 +00001#!/bin/sh
2# autotest control init script, intended for Debian/Ubuntu type boxes.
3#
4# copy this to /etc/init.d/autotest, then run this:
5#
6# update-rc.d autotest start 95 2 3 4 5 . stop 90 0 1 6 .
7
8BASE_DIR=/usr/local/autotest
9BECOME_USER=autotest
10
11if (test -r /lib/lsb/init-functions)
12then
13 . /lib/lsb/init-functions
14else
15 echo "This script requires /lib/lsb/init-functions"
16 exit 1
17fi
18
19# ---
20
21autotest_start() {
22 cd /tmp
23
mblighabd7e482009-09-04 16:32:45 +000024 log_daemon_msg "Starting monitor_db_babysitter"
lmrdd079d42010-05-19 17:24:29 +000025 ( ulimit -v 2048000 ; \
mbligh8b2655c2009-12-29 02:41:13 +000026 start-stop-daemon --start --quiet --chuid $BECOME_USER \
27 --background --exec $BASE_DIR/scheduler/monitor_db_babysitter )
mblighabd7e482009-09-04 16:32:45 +000028}
29
30stop_daemon() {
31 PID_NAME=$1
32 DAEMON_NAME=$2
33 log_daemon_msg "Stopping $DAEMON_NAME"
34 start-stop-daemon --stop --quiet --pidfile $BASE_DIR/$PID_NAME.pid
35}
36
37autotest_stop() {
38 stop_daemon monitor_db_babysitter babysitter
39 stop_daemon monitor_db scheduler
mblighabd7e482009-09-04 16:32:45 +000040}
41
42case "$1" in
43 start)
44 autotest_start
45 ;;
46
47 stop)
48 autotest_stop
49 ;;
50
51 restart)
52 autotest_stop
53 sleep 2
54 autotest_start
55 ;;
56
57 *)
58 echo "Usage: $0 start|stop|restart"
59 exit 1
60
61esac