systemd 237 ignores --nice value in systemd-run
This commit is contained in:
@@ -42,6 +42,11 @@ else
|
||||
[[ "$BOX_ENV" == "cloudron" ]] && options="${options} -p BindsTo=box.service"
|
||||
fi
|
||||
|
||||
# systemd 237 on Ubunut 18.04 does not apply --nice
|
||||
if [[ "${ubuntu_version}" == "18.04" ]]; then
|
||||
(sleep 1; pid=$(systemctl show "${service_name}" -p MainPID | sed 's/MainPID=//g'); renice -n ${nice} -g ${pid} || true) &
|
||||
fi
|
||||
|
||||
# DEBUG has to be hardcoded because it is not set in the tests. --setenv is required for ubuntu 16 (-E does not work)
|
||||
systemd-run --unit "${service_name}" --nice "${nice}" --uid=${id} --gid=${id} ${options} \
|
||||
--setenv HOME=${HOME} --setenv USER=${SUDO_USER} --setenv DEBUG=box:* --setenv BOX_ENV=${BOX_ENV} --setenv NODE_ENV=production \
|
||||
@@ -59,5 +64,7 @@ if [[ "${ubuntu_version}" == "16.04" ]]; then
|
||||
systemctl stop "${service_name}" || true # because of remain-after-exit we have to deactivate the service
|
||||
fi
|
||||
|
||||
[[ "${ubuntu_version}" == "18.04" ]] && wait # for the renice subshell we started
|
||||
|
||||
echo "Service ${service_name} finished with exit code ${exit_code}"
|
||||
exit "${exit_code}"
|
||||
|
||||
Reference in New Issue
Block a user