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