wait until the transmission-daemon terminates properly

We should wait for the termination of the transmission-daemon before the s6 service issues a sigterm to all remaining processes.
Without this delay the s6 sigterms are issued right after the RPC 'transmission-remote --exit'. This leaves not time to properly save the settings.json file, stats.json file, all resume files and showing the closing message 'Closing transmission session... done'.

This commit should fix the following issue: https://github.com/linuxserver/docker-transmission/issues/80
This commit is contained in:
0b100100
2021-07-09 09:22:06 +02:00
committed by GitHub
parent 565fbda515
commit 3537965254

View File

@@ -2,11 +2,15 @@
_term() {
echo "Caught SIGTERM signal!"
echo "Tell the transmission session to shut down."
pid=$(pidof transmission-daemon)
if [ ! -z "$USER" ] && [ ! -z "$PASS" ]; then
/usr/bin/transmission-remote -n "$USER":"$PASS" --exit
else
/usr/bin/transmission-remote --exit
fi
# terminate when the transmission-daemon process dies
tail --pid=${pid} -f /dev/null
}
trap _term SIGTERM