Can I run cron jobs on HPC login nodes?#

Update 2024-10-01: This procedure has been superseded by the Slurm scrontab feature, now available on Levante.

For system administration reasons users are not allowed to shedule and execute periodic jobs on DKRZ HPC systems using the cron utility. Our recommendation is to use the functionality provided by the workload manager Slurm for this purpose. With the option --begin of the sbatch command you can postpone the execution of your jobs until the specified time. For example, to run a job every day after 12pm you can use the following job script re-submitting itself at the beginning of the execution:

#!/bin/bash
#SBATCH --begin 12:00
#SBATCH --account=<prj-account>
#SBATCH --partition=shared
#SBATCH --time=01:00:00
#SBATCH --output=my_script.o%j

set -e

# Re-submit job script for the next execution
sbatch my_script.sh

# Do planned work

A variety of different date and time specifications is possible with the --begin option, for example: now+1hour, midnight, noon, teatime, YYYY-MM-DD[Thh:mm:ss], 7AM, 6PM etc. For more details see manual pages of the sbatch command:

$ man sbatch

With Slurm the scheduled tasks are kept highly available while cron is not tolerant of single system failures (i.e. if a login node chosen for execution of cron jobs were to fail, the jobs would not be executed). The other advantage of using Slurm is that job output is logged to a unique file (see option --output) by default.