[Linux] How do I create scheduled tasks with cron?

Running FileBot from the console, Groovy / FileBot scripting, shell scripts, etc
Locked
User avatar
rednoah
The Source
Posts: 19917
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

[Linux] How do I create scheduled tasks with cron?

Post by rednoah »

cron is a standard Linux tool that is in charge of running scheduled tasks.


Write your script:

Write a bash script that performs your tasks and make it executable:

Code: Select all

vi nightly.sh

Code: Select all

#!/bin/sh
filebot -script fn:amc --output "/path/to/output" --action duplicate -non-strict "/path/to/input" --log-file amc.log --def excludeList=amc.txt

Code: Select all

chmod +x nightly.sh

Configure cron to call your script:

Edit crontab:

Code: Select all

vi /etc/config/crontab
Run nightly.sh every day at 04:00 in the morning:

Code: Select all

0 4 * * * /path/to/nightly.sh > /path/to/nightly.log 2>&1
:idea: You may need to restart your machine (or just the cron service) for changes to take effect.

:idea: Keep your crontab simple! Do use the absolute path to the executable. Do redirect standard output and error output, so you can see what the log says later.
:idea: Please read the FAQ and How to Request Help.
Locked