diff options
author | Keith Holman <Keith.Holman@windriver.com> | 2014-05-26 09:13:06 -0400 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2014-05-26 11:34:21 -0400 |
commit | 9edd687e5a121b8d764904572914a3b32e369488 (patch) | |
tree | dc6eb0751c28f5476c74216384e63855da170984 | |
parent | 0d4a0080588ca9022bcbf83550e5e32a2bd0c750 (diff) | |
download | meta-cloud-services-9edd687e5a121b8d764904572914a3b32e369488.tar.gz |
tgt: prevent service from being started multiple times
Using the /etc/init.d/tgtd script, allows the service be started
multiple times, but only the last instance can be stopped using
the script. This fix ensures that the service isn't running
before attempting to start the service multiple times.
Signed-off-by: Keith Holman <Keith.Holman@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
-rw-r--r-- | meta-openstack/recipes-support/tgt/files/tgtd.init | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/meta-openstack/recipes-support/tgt/files/tgtd.init b/meta-openstack/recipes-support/tgt/files/tgtd.init index 8c07926..52d98c3 100644 --- a/meta-openstack/recipes-support/tgt/files/tgtd.init +++ b/meta-openstack/recipes-support/tgt/files/tgtd.init | |||
@@ -17,6 +17,15 @@ TGTD_CONFIG=/etc/tgt/targets.conf | |||
17 | start () | 17 | start () |
18 | { | 18 | { |
19 | echo -n "Starting $DESC..." | 19 | echo -n "Starting $DESC..." |
20 | |||
21 | # Ensure service isn't running | ||
22 | tgt-admin -s >/dev/null 2>&1 | ||
23 | RETVAL=$? | ||
24 | if [ "$RETVAL" -ne 107 ] ; then | ||
25 | echo "$DESC is already running." | ||
26 | exit 1 | ||
27 | fi | ||
28 | |||
20 | # Start tgtd first | 29 | # Start tgtd first |
21 | $DAEMON &>/dev/null | 30 | $DAEMON &>/dev/null |
22 | RETVAL=$? | 31 | RETVAL=$? |