Skip to content

Commit

Permalink
Workaround init script systemd stop problems
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
tramjoe committed Oct 20, 2014
1 parent 4970a79 commit 6608e04
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripts/target.init
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 6608e04

Please sign in to comment.