Scheduled tasks (cron)

From HPCwiki
Jump to navigation Jump to search

Recurring, scheduled tasks on Anunna should be run through the scheduler with scrontab, SLURM's built-in cron. scrontab uses the familiar crontab syntax, but runs each scheduled task as a SLURM job on a compute node — so your recurring work gets proper resources and does not load the shared login nodes.

 ⚠️ Warning: Do not use a plain login-node crontab for recurring work. Anything scheduled with crontab runs on the login node, which is a shared access point not meant for computation, and the crontab is wiped when the login node reboots. Use scrontab instead.

Using scrontab

Edit your scrontab with:

scrontab -e

Each entry has two parts: one or more #SCRON lines that set the SLURM options for the job (partition, time limit, resources, job name, …), followed by a normal crontab time specification and the command to run.

#SCRON --partition=main
#SCRON --time=00:10:00
#SCRON --job-name=daily-download
0 2 * * * /home/<group>/<username>/scripts/download.sh

This runs download.sh as a SLURM job every day at 02:00. List your current entries with:

scrontab -l

The crontab time format (the 0 2 * * * part) is described in the crontab manual page:

man 5 crontab

See also