summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJerome Martin <jxm@netiant.com>2014-10-21 01:49:56 +0200
committerJerome Martin <jxm@netiant.com>2014-10-21 01:51:47 +0200
commit6608e04eb0143d8770bd3814a3ef02effdd825c9 (patch)
tree86b6dc2cadba9b14600d9682f514daa29f342f4d /scripts
parent4970a79a577dfe798a0240e3dd39581dbbeb71f0 (diff)
downloadtargetcli-6608e04eb0143d8770bd3814a3ef02effdd825c9.tar.gz
Workaround init script systemd stop problems
* At least when the previous start failed, systemsd does not actually run the script when stop action is invoked. There might be other cases. * Solve this by actually restarting when start is invoked.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/target.init7
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/target.init b/scripts/target.init
index 3c7dc36..83960dc 100755
--- a/scripts/target.init
+++ b/scripts/target.init
@@ -214,7 +214,10 @@ unload_modules()
load_config()
{
-if [ -e "${STARTUP_CONFIG}" ]; then
+
+if [ $(cat /etc/target/scsi_target.lio 2>/dev/null | tr -d " \n\t" | wc -c) = 0 ]; then
+ log_warning "Startup config ${STARTUP_CONFIG} is empty, skipping"
+elif [ -e "${STARTUP_CONFIG}" ]; then
export __STARTUP_CONFIG="${STARTUP_CONFIG}"
python 2> /dev/null << EOF
import os, rtslib
@@ -304,6 +307,8 @@ do_status()
case "$1" in
start)
+ # FIXME This is because stop fails with systemd on debian jessie
+ do_stop
do_start
;;
stop)