remove svn keywords
[nodemanager.git] / initscripts / nm
1 #!/bin/bash
2 #
3 # nm       Starts and stops Node Manager daemon
4 #
5 # chkconfig: 3 86 26
6 # description: Starts and stops Node Manager daemon
7 #
8
9 # Source function library.
10 . /etc/init.d/functions
11
12 [ -f /etc/sysconfig/nodemanager ] && . /etc/sysconfig/nodemanager
13
14 options=${OPTIONS-"-d"}
15 # turn on verbosity
16 verboseoptions=${DEBUGOPTIONS-"-v -d"}
17 # debug mode is interactive, and has faster period 
18 # run in deamon mode with service nm restardebug -d
19 debugoptions=${DEBUGOPTIONS-"-v -p 30 -r 15"}
20
21 nodemanager=${NODEMANAGER-"python /usr/share/NodeManager/nodemanager.py"}
22 prog="Node Manager"
23 pidfile=${PIDFILE-/var/run/nodemanager.pid}
24
25 RETVAL=0
26
27 function start() {
28     action $"Starting $prog: " daemon --pidfile=$pidfile --check=nodemanager $nodemanager "$@"
29 }
30
31 function stop() {
32     action $"Stopping $prog: " killproc -p $pidfile nodemanager
33 }
34
35 case "$1" in
36     start)
37         start $options
38         ;;
39     stop)
40         stop
41         ;;
42     status)
43         status -p $pidfile nodemanager
44         RETVAL=$?
45         ;;
46     restart|reload)
47         shift
48         stop
49         start $options "$@"
50         ;;
51     condrestart)
52         shift
53         [ -f ${pidfile} ] && { stop; start $options "$@"; }
54         ;;
55     restartverbose)
56         shift
57         stop
58         $nodemanager $verboseoptions "$@"
59         ;;
60     restartdebug)
61         shift
62         stop
63         echo "Restarting with $debugoptions $@ .."
64         $nodemanager $debugoptions "$@"
65         ;;
66     *)
67         echo $"Usage: $0 {start|stop|status|restart|condrestart|restartdebug [-d]}"
68         exit 1
69         ;;
70 esac
71
72 exit $RETVAL