PHLAK / docker-flexget

Docker image for Flexget client.
https://hub.docker.com/r/phlak/flexget/
MIT License
3 stars 1 forks source link

Remove .config-lock on start? #1

Closed oscar-b closed 4 years ago

oscar-b commented 6 years ago

Hi

When the Flexget crashes, it can't start again due to the .config-lock file being left. Would it be possible to add a way to automatically remove this file when re-starting?

PHLAK commented 6 years ago

I've definitely run into this issue before myself, however, I'm not sure how to fix this. As far as I know Docker doesn't have a way to run a command before (or after) starting/restarting a container.

The only way I can think of to do this would be to change the CMD line in the Dockerfile to something like:

CMD ["rm", "-f", "/etc/flexget/.config-lock && flexget", "&&", "flexget", "-c", "/etc/flexget/config.yml", "--loglevel", "verbose", "daemon", "start"]

However, this would totally break the single process nature of Docker and I'm not even sure that would work. If you have any other ideas please share.

In the event this does happen to you though you can solve it like so (assuming you followed the README and named your containers/volumes the same):

  1. Stop the container
docker stop flexget-client
  1. Remove the .config-lock file from the volume
docker run -it --rm -v flexget-data:/etc/flexget phlak/flexget phlak/flexget rm /etc/flexget/.config-lock
  1. Start the container.
docker start flexget-client
oscar-b commented 6 years ago

Using a bash script which deletes the file before launching Flexget doesn’t break single process of Docker since it won’t run simultaneously, and I think this is a totally fine way of solving it. Would be better with an option in Flexget itself though, but that might be more of a hassle to implement.

oscar-b commented 4 years ago

@PHLAK Seen that Flexget themselves recommend removing the lock file on start? https://flexget.com/InstallWizard/SynologyNAS/Docker

PHLAK commented 4 years ago

Good to know @oscar-b, also leaving this here as a note for myself: https://stackoverflow.com/a/41518225

PHLAK commented 4 years ago

Resolved with https://github.com/PHLAK/docker-flexget/commit/84449dc93c9f1a596f6c7a15ad0ffe39df428f64