launcher: do not mask Jackett exit code (#13815)

Currently, in the launcher script the whoami and updater loop are masking the exit code of Jackett. So even if Jackett errors out, the systemd service sees an exit code of "0", which e.g. breaks the `Restart=on-failure` in the [non-mono service template](https://github.com/Jackett/Jackett/wiki/Systemd-service#not-using-mono).

This commit stores the exit code of Jackett in a variable and exits the script explicitly with this exit code, after the updater has been waited for. This way `Restart=on-failure` again can apply and `systemctl status jackett` reports the correct status if Jackett failed.

Signed-off-by: MichaIng <micha@dietpi.com>
This commit is contained in:
MichaIng 2022-12-30 09:17:37 +01:00 committed by GitHub
parent 3a0403958a
commit de6effabb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -8,6 +8,7 @@ JACKETT_DIR="$(dirname "$(readlink -f "$0")")"
# Launch Jackett (with CLI parameters)
"${JACKETT_DIR}/jackett" --NoRestart "$@"
ec=$?
# Get user running the service
JACKETT_USER=$(whoami)
@ -16,3 +17,5 @@ JACKETT_USER=$(whoami)
while pgrep -u "${JACKETT_USER}" JackettUpdater > /dev/null; do
sleep 1
done
exit $ec