Cron Jobs
4 minute read.
Last Modified 2021-03-24 14:35 EDTTrueNAS allows users to run specific commands or scripts on a regular schedule using cron(8). This can be helpful for running repetitive tasks.
To create a cron job, go to Tasks > Cron Jobs and click ADD.
The Description helps identify the cron job’s purpose and is optional.
Next, enter the exact Command to run on the Schedule. Alternately, enter the path to a script file to run instead of a specific command.
Don’t forget to define the shell type when using a path to a script file. For example, a script written forsh
must be specified assh /mnt/pool1/helloWorld.sh
.
Select an existing TrueNAS user account with the necessary permissions to run the command or script.
Next, define the Command Schedule. Various preset schedules are available. There is also an advanced scheduler for very specific schedule requirements.
Additional Options:
When Hide standard output (stdout) is unset, any standard output is mailed to the user account used to run the command.
When Hide Standard Error (stderr) is unset, any error output is mailed to the user account used to run the command. This can be useful to help debug the command or script if an error occurs.
Unsetting Enabled only keeps the task from automatically running. You can still save the cron job and run it manually.
To see all created cron jobs, go to Tasks > Cron Jobs. Click the next to an entry to see details and options.
Clicking RUN NOW immediately starts the job Command, separately from any Schedule. EDIT changes any setting available during task creation. DELETE removes the cron job from TrueNAS. Once a cron job is deleted, the job configuration cannot be restored.