fradelg/docker-mysql-cron-backup

Make backup on container shutdown

g-nardiello opened this issue · 9 comments

How is possible to automatically make a backup when I'm shutdown the container?

I use automatic backup with cron and automatic restore on startup. If I restart the container, it restores the last backup and I lose all modifications made after that.

Could you help me?
Thanks

Hi,

In you case, you should just remove the INIT_RESTORE_LATEST variable in the container environment.

Actually, I wouldn't recommend to use this option as it is better to restore the backups when you start from scratch and that can be done running the container once without the CRON task.

If you still want to go that path, I would recommend you to check the bash trap command

Regards

Hi,

Thank you very much! I need an integrated solution, so I'll develop trap as you suggest. I could to add a TRAP with SIGHUP SIGINT SIGTERM to start a last backup before closing. If you wish, I could pull that feature with a flag when is completed!

Regards

Awesome. Yes, please submit your PR when you think is ready and it works for your use case.

Thanks!

Hi, I completed my work on that feature and it works on my environment. I created PR for the feature.

I created also PR for bugs I found on my working environment, and for other useful features I implemented!

That's really impressive! Thank you so much!

I made a few minor comments to some of the PRs and merge others. I will review them as soon as I can.

Thank you! I replied, I will also watch again as soon I can.

Hi, I think this is solved.

Could you also release a new tagged version and tagged docker image with the last features, please?

Done! Can you close this issue when you feel it is really solved?

Great, thanks!