pass memory limit as argument to starttask.sh

This commit is contained in:
Girish Ramakrishnan
2020-08-10 21:53:07 -07:00
parent 02ee13cfb2
commit 7039108438
2 changed files with 4 additions and 3 deletions

View File

@@ -23,6 +23,7 @@ fi
readonly task_id="$1"
readonly logfile="$2"
readonly nice="$3"
readonly memory_limit_mb="$4"
readonly service_name="box-task-${task_id}"
systemctl reset-failed "${service_name}" || true
@@ -31,9 +32,9 @@ readonly id=$(id -u $SUDO_USER)
readonly ubuntu_version=$(lsb_release -rs)
if [[ "${ubuntu_version}" == "16.04" ]]; then
options="-p MemoryLimit=400M --remain-after-exit"
options="-p MemoryLimit=${memory_limit_mb}M --remain-after-exit"
else
options="-p MemoryMax=400M --pipe --wait"
options="-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.