added stop
[monitor.git] / monitor-runlevelagent.init
1 #!/bin/bash
2 #
3 # monitor-runlevelagent starts the RunlevelAgent in production mode.
4 #
5 # Load before nm, vcached, and vservers, vserver-reference
6 # chkconfig: 3 14 85
7 # description: Start RunlevelAgent to report the current Runlevel to PLC at
8 #               periodic intervals.
9 #
10 # Stephen Soltesz <soltesz@cs.princeton.edu>
11 # Copyright (C) 2008 The Trustees of Princeton University
12 #
13 # $Id$
14 #
15
16 function start_rla ()
17 {
18         ret=$( pgrep -f -l RunlevelAgent )
19         if [[ -z $ret ]] ; then
20             echo "Starting RunlevelAgent"
21                 if [[ -f RunlevelAgent.py ]] ; then 
22                         RLA="/usr/bin/python ./RunlevelAgent.py"
23                 else
24                         RLA=/usr/bin/RunlevelAgent.py
25                 fi
26                 $RLA &> /var/log/rla.log &
27         fi
28 }
29
30 case "$1" in
31     start|restart|reload)
32
33                 start_rla
34
35         ;;
36     stop|status)
37                 pkill -f RunlevelAgent
38                 exit 0
39         ;;
40     *)
41                 echo $"Usage: $0 {start|stop|restart|status}"
42         exit 1
43         ;;
44 esac
45