summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-support/tgt/files/tgtd.init
diff options
context:
space:
mode:
authorMihai Prica <prica.mihai@gmail.com>2013-06-11 14:44:55 +0300
committerBruce Ashfield <bruce.ashfield@windriver.com>2013-08-28 18:41:56 -0400
commitb72360be0414ce6f9c7dba877617ef336034109d (patch)
tree4016f9f04dc2e159a9bba3246bf753eba7d6b855 /meta-openstack/recipes-support/tgt/files/tgtd.init
parent89f005550007fbaf1d9a8fa0013a0f8d12262a40 (diff)
downloadmeta-cloud-services-b72360be0414ce6f9c7dba877617ef336034109d.tar.gz
tgt: added 1.0.36
Signed-off-by: Mihai Prica <prica.mihai@gmail.com>
Diffstat (limited to 'meta-openstack/recipes-support/tgt/files/tgtd.init')
-rw-r--r--meta-openstack/recipes-support/tgt/files/tgtd.init61
1 files changed, 61 insertions, 0 deletions
diff --git a/meta-openstack/recipes-support/tgt/files/tgtd.init b/meta-openstack/recipes-support/tgt/files/tgtd.init
new file mode 100644
index 0000000..656a243
--- /dev/null
+++ b/meta-openstack/recipes-support/tgt/files/tgtd.init
@@ -0,0 +1,61 @@
1#!/bin/sh
2
3DESC="tgtd"
4DAEMON="/usr/sbin/tgtd"
5PIDFILE="/var/run/tgtd.pid"
6
7start ()
8{
9 if [ -e $PIDFILE ]; then
10 PIDDIR=/proc/$(cat $PIDFILE)
11 if [ -d ${PIDDIR} ]; then
12 echo "$DESC already running."
13 exit 1
14 else
15 echo "Removing stale PID file $PIDFILE"
16 rm -f $PIDFILE
17 fi
18 fi
19
20 echo -n "Starting $DESC..."
21
22 start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
23 --make-pidfile --exec ${DAEMON}
24
25 if [ $? -eq 0 ]; then
26 echo "done."
27 else
28 echo "failed."
29 fi
30}
31
32stop ()
33{
34 echo -n "Stopping $DESC..."
35 start-stop-daemon --stop --quiet --pidfile $PIDFILE
36 if [ $? -eq 0 ]; then
37 echo "done."
38 else
39 echo "failed."
40 fi
41 rm -f $PIDFILE
42}
43
44case "$1" in
45 start)
46 start
47 ;;
48 stop)
49 stop
50 ;;
51 restart|force-reload)
52 stop
53 start
54 ;;
55 *)
56 echo "Usage: $0 {start|stop|force-reload|restart}"
57 exit 1
58 ;;
59esac
60
61exit 0