Creating the FlexGet config file on Ubuntu

For details on how to install FlexGet see the How to install FlexGet on Ubuntu Guide.

Once we have installed FlexGet we now need to create the FlexGet configuration file. The configuration file is where we'll store all the instructions for FlexGet. ie. What to download and from where.

A note about the storing of configuration files

If you're following my advice about storing configuration files separately then issue the following two commands in a Putty session:

sudo touch /media/WD40EFRX/RAIDMain/MyScripts/config.yml

sudo ln -s /media/WD40EFRX/RAIDMain/MyScripts/config.yml /var/lib/deluge/.flexget/config.yml

obviously substituting /media/WD40EFRX/RAIDMain/MyScripts with the location of your script files.

Now type the following command to create/open the file:

sudo -u deluge vim /var/lib/deluge/.flexget/config.yml

Enter the configuration parameters as required. See the FlexGet website for configuration examples.

I've included a working example to allow you to test the process is working correctly: Sample config.yml file and explained what the various lines do on this page.

Running FlexGet as the "deluge" user

Firstly switch the working folder:

cd /

To run the FlexGet script we've just created type the following:

sudo -H -u deluge flexget execute

Testing your FlexGet config file

You can run through the FlexGet script in "test mode" to execute all parts of the script by specifying the --test parameter as follows:

sudo -H -u deluge flexget --test execute

Displaying verbose output

The -v parameter can be used to display verbose output from the FlexGet script. This can be particularly useful when the feeds are not quite working as you would expect:

sudo -H -u deluge flexget execute -v

You can additionally run the above commands in combination. So, to test the script whilst displaying verbose output you would issue the following command:

sudo -H -u deluge flexget --test execute -v

Checking configuration syntax

When you have made changes to the FlexGet config file you can check the syntax by specifying the --check parameter as follows:

 sudo -H -u deluge flexget check

How to wipe the FlexGet database and start over

FlexGet keeps a record of what files it has and has not downloaded in an SQL database. If you ever want to wipe everything and start over then issue the following command:

sudo -u deluge rm /var/lib/deluge/.flexget/db-config.sqlite

Run FlexGet as a cron job using Webmin

FlexGet will execute your script each time it runs and pull down any new torrent files it finds. It is therefore desirable to run this script regularly and the best way to do this is via the use of a cron job. I use Webmin to administer my server and creating cron jobs using Webmin is an absolute breeze.

So, launch Webmin then click on System and then Scheduled Cron Jobs. Then click Create a new scheduled cron job at the top of the screen that opens.

Click the button next to the Execute cron job as and choose the "deluge" user.

Type the full path of FlexGet into the Command box. So: /usr/local/bin/flexget

In the When to Execute section select Simple Schedule and choose Hourly from the drop down list.

Then click the Create button.

FlexGet will now check every hour for new torrent files and download them for you. Deluge will then take over and start downloading the actual files themselves for you.

Still stuck? Not what you were looking for? Then head over to the Discussion Forum