Page 1 of 1

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

Posted: 25 Nov 2020, 10:04
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


Code: Select all

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

Configure cron to call your script:

Edit crontab:

Code: Select all

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

Code: Select all

0 4 * * * /path/to/ > /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.