Take the new doc out of the branch and into trunk
[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$
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 restartoptions=
20 pidfile=${PIDFILE-/var/run/nm.pid}
21 lockfile=${LOCKFILE-/var/lock/subsys/nm}
22 RETVAL=0
23
24 do_start()
25 {
26     options=$1
27     echo -n $"Starting $prog: "
28     daemon --check=nm $nm $options
29     RETVAL=$?
30     echo
31     [ $RETVAL -eq 0 ] && touch ${lockfile}
32     return $RETVAL
33 }
34
35 start()
36 {
37     do_start ${OPTIONS-"-d -s"}
38 }
39
40 stop()
41 {
42     echo -n $"Stopping $prog: "
43     killproc nm
44     RETVAL=$?
45     echo
46     [ $RETVAL -eq 0 ] && rm -f ${lockfile} ${pidfile}
47 }
48
49 restart()
50 {
51     stop
52     do_start ${OPTIONS-"-d"}
53 }
54
55
56 case "$1" in
57     start)
58         start
59         ;;
60     stop)
61         stop
62         ;;
63     status)
64         status $nm
65         RETVAL=$?
66         ;;
67     restart|reload)
68         restart
69         ;;
70     condrestart)
71         if [ -f ${pidfile} ] ; then
72             restart
73         fi
74         ;;
75     *)
76         echo $"Usage: $0 {start|stop|restart|condrestart|status}"
77         exit 1
78 esac
79
80 exit 0