diff --git a/src/scripts/starttask.sh b/src/scripts/starttask.sh index 118ac3204..5a19d9694 100755 --- a/src/scripts/starttask.sh +++ b/src/scripts/starttask.sh @@ -32,9 +32,9 @@ readonly id=$(id -u $SUDO_USER) readonly ubuntu_version=$(lsb_release -rs) if [[ "${ubuntu_version}" == "16.04" ]]; then - options="-p MemoryLimit=${memory_limit_mb}M --remain-after-exit" + options="-p TimeoutStopSec=10s -p MemoryLimit=${memory_limit_mb}M --remain-after-exit" else - options="-p MemoryMax=${memory_limit_mb}M --pipe --wait" + options="-p TimeoutStopSec=10s -p MemoryMax=${memory_limit_mb}M --pipe --wait" # Note: BindsTo will kill this task when the box is stopped. but will not kill this task when restarted! # For this reason, we have code to kill the tasks both on shutdown and startup. diff --git a/src/scripts/stoptask.sh b/src/scripts/stoptask.sh index 6254e129d..932d0c579 100755 --- a/src/scripts/stoptask.sh +++ b/src/scripts/stoptask.sh @@ -24,8 +24,10 @@ if [[ "${task_id}" == "all" ]]; then systemctl kill --signal=SIGTERM box-task-* || true systemctl reset-failed box-task-* 2>/dev/null || true systemctl stop box-task-* || true # because of remain-after-exit in Ubuntu 16 we have to deactivate the service + echo "All tasks stopped" else readonly service_name="box-task-${task_id}" systemctl kill --signal=SIGTERM "${service_name}" || true systemctl stop "${service_name}" || true # because of remain-after-exit in Ubuntu 16 we have to deactivate the service + echo "${service_name} stopped" fi