I have created a docker image which is based of arch-plex.
I created this image because I wanted to have the database in memory so Plex would be faster.
The image includes nightly copying the database as a backup to the config folder.
Now I need some advice for creating the backup when the container receives the SIGTERM signal when it's stopped or restarted. I already figured out how I can wait for the Plex service to die and start copying the database.
However you will get a incomplete backup if it takes longer than 10 seconds to create the backup. Because this is the default time before the SIGKILL signal is sent by docker.
Is there a way to keep the container alive untill the backup has finished, without increasing the timeout before SIGKILL is send? Meaning I would like to have the solution in the image.
I don't mind if I have to use another language than bash/shell, as long as it is a pre-compiled language.