SIGTERM now stops crond

This means `docker stop` will be faster
This commit is contained in:
Robert Dailey 2018-12-06 17:32:05 -06:00
parent ab6372fa79
commit 990ee018d2
1 changed files with 13 additions and 1 deletions

View File

@ -27,4 +27,16 @@ echo "$containerId" > /tmp/containerId
echo "*/$NEXTCLOUD_CRON_MINUTE_INTERVAL * * * * /cron-tasks.sh $containerId" \
> /var/spool/cron/crontabs/root
exec crond -f -l 0 -L /dev/stdout
# Watch for SIGTERM (someone stops the docker container) so we can tell crond to exit
_term() {
echo "Caught SIGTERM signal!"
kill -TERM "$child" 2>/dev/null
}
trap _term SIGTERM
exec crond -f -l 0 &
echo "Started crond"
child=$!
wait "$child"