Jobs at regular intervals

If you have small tasks you want to run at regular intervals, Slurm has the scrontab utility available. It gives you a cron-like interface for submitting and running batch jobs at regular intervals, e.g. monitoring tasks or housekeeping scripts.


Like cron, Slurm uses a configuration file to define these recurring jobs. Each users has it's own configuartion file. The files are not edited dierctly, but instead you can use scrontab -e to edit 1) your all your scrontab-jobs.

Inside the scrontab file, you can use #SCRON to give instructions to the scheduler, similar to the #SBATCH lines in normal jobscript, though not all options are supported. After the #SCRON lines, you have one line to define when and what should be done, just like a normal cron job.

You have two styles of defining when you job should run:

  1. common time intervals, e.g. @hourly, @daily, @weekly

The latter can get quite complex, but there are online tools out there to help you with it. After defining when something should run, you can give a command or a script that is run at the appropriate time. The command or script has to be on the same line. The command to execute does not need to be a Slurm jobscript (i.e. should not contain #SBATCH lines).

These #SCRON lines and the following line comprise a single scrontab entry. All #SCRON lines following will be counted towards the next command.

You can list your currently defined scron jobs with scrontab -l.

Slurm cannot guarantee that the jobs will run at the requested times, but tries to schedule it es close as possible. Internally, jobs are submitted to Slurm and set with a specific BeginTime. Once a scron job ran, it will be requeued with a new BeginTime. These jobs will also show up in squeue.


#SCRON -p fat
#SCRON -t 01:00:00
@daily /usr/users/mboden/
#SCRON -p medium
#SCRON -C scratch
#SCRON -t 05:00
#check scratch every 5 minutes
*/15 * * * * /usr/users/mboden/
scrontab uses the editor saved in the $EDITOR variable.
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies