1#!/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 24 log_daemon_msg "Starting monitor_db_babysitter" 25 ( ulimit -v 2048000 ; \ 26 start-stop-daemon --start --quiet --chuid $BECOME_USER \ 27 --background --exec $BASE_DIR/scheduler/monitor_db_babysitter ) 28} 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 40} 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 62