TrueNAS CORETrueNAS CORE Nightly Development Documentation
This content follows experimental early release software. Use the Product and Version selectors above to view content specific to a stable software release.

Creating Cron Jobs

TrueNAS allows users to run specific commands or scripts on a regular schedule using cron(8).

Creating a Cron Job

Go to Tasks > Cron Jobs and click ADD.

TasksCronJobsAdd

The Description helps identify the purpose of the cron job and is optional.

Enter the 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 for sh must be specified as sh /mnt/pool1/helloWorld.sh.

Select a TrueNAS user account with the necessary permissions to run the Command or script.

Next, define the Command Schedule.

Additional Options:

  • When Hide Standard Output (stdout) is unset, TrueNAS mails any standard output to the user account that runs the Command.
  • When Hide Standard Error (stderr) is unset, TrueNAS mails any error output to the user account that runs the Command. Unsetting Hide Standard Error helps 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.

Managing a Cron Job

Go to Tasks > Cron Jobs and click the next to an entry to see details and options.

TasksCronJobsOptions

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 you delete a cron job, you cannot restore the job configuration.