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