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