fradelg / docker-mysql-cron-backup

Docker image to backup all your databases periodically
Apache License 2.0
290 stars 111 forks source link

[Feature] Make backup on container shutdown #93

Closed g-nardiello closed 1 year ago

g-nardiello commented 1 year ago

Resolve Issue #90, named Make backup on container shutdown, adding feature to make backup on container shutdown. To archieve a container gracefully stop, it traps SIGHUP, SIGINT, SIGTERM signals from run.sh.

As trap in a docker container only works for the main process, to correctly trap the signals, it was necessary to make crond as a background deamon, paying attention to keep crond logs on main container log journal.

It uses EXIT_BACKUP environment variable, as described on updated Readme.md: