summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools/python/python-nova/nova.init
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-nova/nova.init')
-rw-r--r--meta-openstack/recipes-devtools/python/python-nova/nova.init72
1 files changed, 72 insertions, 0 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-nova/nova.init b/meta-openstack/recipes-devtools/python/python-nova/nova.init
new file mode 100644
index 0000000..3a2bbac
--- /dev/null
+++ b/meta-openstack/recipes-devtools/python/python-nova/nova.init
@@ -0,0 +1,72 @@
1#!/bin/sh
2
3### BEGIN INIT INFO
4# Provides: nova-compute
5# Required-Start: $remote_fs $syslog
6# Required-Stop: $remote_fs $syslog
7# Default-Start: 3 5
8# Default-Stop: 0 1 2 6
9# Short-Description: OpenStack Compute (Nova) - @suffix@
10# Description: OpenStack Compute (Nova) - @suffix@
11### END INIT INFO
12
13SUFFIX="@suffix@"
14DESC="nova-@suffix@"
15DAEMON="/usr/bin/nova-$SUFFIX"
16PIDFILE="/var/run/nova-$SUFFIX.pid"
17
18start ()
19{
20 if [ -e $PIDFILE ]; then
21 PIDDIR=/proc/$(cat $PIDFILE)
22 if [ -d ${PIDDIR} ]; then
23 echo "$DESC already running."
24 exit 1
25 else
26 echo "Removing stale PID file $PIDFILE"
27 rm -f $PIDFILE
28 fi
29 fi
30
31 echo -n "Starting $DESC..."
32
33 start-stop-daemon --start --quiet --background \
34 --pidfile ${PIDFILE} --make-pidfile --exec ${DAEMON}
35
36 if [ $? -eq 0 ]; then
37 echo "done."
38 else
39 echo "failed."
40 fi
41}
42
43stop ()
44{
45 echo -n "Stopping $DESC..."
46 start-stop-daemon --stop --quiet --pidfile $PIDFILE
47 if [ $? -eq 0 ]; then
48 echo "done."
49 else
50 echo "failed."
51 fi
52 rm -f $PIDFILE
53}
54
55case "$1" in
56 start)
57 start
58 ;;
59 stop)
60 stop
61 ;;
62 restart|force-reload)
63 stop
64 start
65 ;;
66 *)
67 echo "Usage: $0 {start|stop|force-reload|restart}"
68 exit 1
69 ;;
70esac
71
72exit 0