clearer names for actions, and infer actions better
[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         args=$1
19         ret=$( pgrep -f -l RunlevelAgent )
20         if [[ -z $ret ]] ; then
21             echo "Starting RunlevelAgent"
22                 if [[ -f RunlevelAgent.py ]] ; then 
23                         RLA="/usr/bin/python ./RunlevelAgent.py"
24                 else
25                         RLA=/usr/bin/RunlevelAgent.py
26                 fi
27                 $RLA $args > /var/log/rla.log 2>&1 &
28         fi
29 }
30
31 case "$1" in
32     start|restart|reload)
33
34                 start_rla $2
35
36         ;;
37     stop|status)
38                 pkill -f RunlevelAgent
39                 exit 0
40         ;;
41     *)
42                 echo $"Usage: $0 {start|stop|restart|status}"
43         exit 1
44         ;;
45 esac
46