Flexget version 1.2 and above add an option to run it as a daemon process instead of executing it several times via script or crontab. The good thing about this change is that now we can have an init script to start the daemon at boot time and forget about the needed crontab or script to run it.
Since this change isn't already on Gentoo's Portage main tree, I've opened Bug 498012 to submit the necessary changes to add it to Portage.
Applying the patch
You can find all the needed files as attachments in the submitted bug.
- flexget-1.2.31: This file is the init.d script, it should be copied to /usr/portage/app-net/flexget/files, create the folder files if it doesn't exist.
- flexget_conf: This file is the conf.d source needed for the init.d script to work, it should be copied to the same folder.
- flexget-1.2.31.patch: This is the ebuild patch, needed to patch the actual flexget ebuild. To update the actual build, run the following:
cd /usr/portage/app-net/flexget patch -p1 flexget-1.2.31.patch
- The last step should be to regenerate the manifest file in /usr/portage/app-net/flexget, since we now have a modified ebuild, to do this, just execute the following inside that directory:
cd /usr/portage/app-net/flexget ebuild flexget-1.2.31.ebuild manifest
Once you've finished applying the patch, you need to reinstall flexget to apply the new configuration. Then you just need to edit the contents of /etc/conf.d/flexgetd with your user and config file and you're ready to run flexget via init.d script.
# /etc/conf.d/flexgetd # Options to pass to flexgetd at startup # Default username to run flexgetd FLEXGET_USER="flex_user" # Flexget configuration file location # Example: "/home/user/.flexget/config.yml" FLEXGET_USER_CONFIG="/home/flex_user/.flexget/config.yml"
Remeber that you can add the init.d script to boot time with rc-update.