package details
[nodemanager.git] / nm.init
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 # $Id: vnet.init,v 1.21 2006/02/27 15:41:27 mlhuang Exp $
9
10 # Source function library.
11 . /etc/init.d/functions
12
13 if [ -f /etc/sysconfig/NodeManager ]; then
14     . /etc/sysconfig/NodeManager
15 fi
16
17 nm=${NM-"python /usr/share/NodeManager/nm.py"}
18 prog="Node Manager"
19 options=${OPTIONS-"-d -s"}
20 pidfile=${PIDFILE-/var/run/nm.pid}
21 lockfile=${LOCKFILE-/var/lock/subsys/nm}
22 RETVAL=0
23
24 start()
25 {
26     echo -n $"Starting $prog: "
27     daemon --check=nm $nm $options
28     RETVAL=$?
29     echo
30     [ $RETVAL -eq 0 ] && touch ${lockfile}
31     return $RETVAL
32 }
33
34 stop()
35 {
36     echo -n $"Stopping $prog: "
37     killproc nm
38     RETVAL=$?
39     echo
40     [ $RETVAL -eq 0 ] && rm -f ${lockfile} ${pidfile}
41 }
42
43 case "$1" in
44     start)
45         start
46         ;;
47     stop)
48         stop
49         ;;
50     status)
51         status $nm
52         RETVAL=$?
53         ;;
54     restart|reload)
55         stop
56         start
57         ;;
58     condrestart)
59         if [ -f ${pidfile} ] ; then
60             stop
61             start
62         fi
63         ;;
64     *)
65         echo $"Usage: $0 {start|stop|restart|condrestart|status}"
66         exit 1
67 esac
68
69 exit 0