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