Skip to main content

SLURM

scrontab is Slurm’s “cron”—it lets you schedule recurring batch jobs (hourly, daily, weekly, etc.) to run on the cluster without you being logged in. It works a lot like Linux crontab, but submits jobs to Slurm. 


How you use it

Open your schedule: scrontab -e (list with scrontab -l, clear with scrontab -r). 

Put Slurm options at the top using #SCRON lines (partition, account, time, outputs, etc.). 

Add cron-style lines (5 time fields + the command/script to run). Times are typically interpreted in UTC on many systems. 

Use full paths and a script that loads your modules/conda env, just like a normal sbatch job. 

 

Minimal example

Runs a script at the start of every hour, on partition high, account sub1, for up to 1 minute, appending output:


#SCRON -p high

#SCRON -A sub1

#SCRON -t 00:01:00

#SCRON -o /home/you/logs/hourly-%j.out

#SCRON --open-mode=append

@hourly /home/you/bin/run_my_task.sh

 

Tips

Put any environment setup inside your script (e.g., module load ...). The scron environment is minimal. 

Use sacct -Dj <JOBID> to view accounting for scrontab-run jobs (the -D flag shows duplicates sometimes created by recurring runs).