From 5bb6ced1ddfa65bc0c3be688a93a1883dd751b08 Mon Sep 17 00:00:00 2001 From: Keith Holman Date: Mon, 26 May 2014 09:13:06 -0400 Subject: 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 Signed-off-by: Bruce Ashfield --- meta-openstack/recipes-support/tgt/files/tgtd.init | 9 +++++++++ 1 file changed, 9 insertions(+) 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 start () { echo -n "Starting $DESC..." + + # Ensure service isn't running + tgt-admin -s >/dev/null 2>&1 + RETVAL=$? + if [ "$RETVAL" -ne 107 ] ; then + echo "$DESC is already running." + exit 1 + fi + # Start tgtd first $DAEMON &>/dev/null RETVAL=$? -- cgit v1.2.3-54-g00ecf