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