scrontab(1)

πŸ’– scrontab(1) β€” Slurm Commands πŸ’–

okay bestie, gather round, because this is the manual page for scrontab, straight out of the Slurm Commands section. it's giving "cron but make it Slurm," and honestly? iconic. let's get into it πŸŽ€


✨ NAME ✨

scrontab β€” manage Slurm crontab files πŸ—“οΈ


✨ SYNOPSIS ✨

scrontab [-u user] file
scrontab [-u user] [ -e | -l | -r ]

✨ DESCRIPTION ✨

so like, scrontab is the whole vibe for setting, editing, and removing a user's Slurm-managed crontab πŸ’…. this file can define a bunch of recurring batch jobs that run on a scheduled interval. set it and forget it, fr fr.

every line in that file has to be one of these:

  • a comment starting with #
  • whitespace (yes, blank lines are valid, we love a breather)
  • a valid crontab entry
  • a custom variable setting

lines that start with #SCRON let you define options for the single following crontab entry ✨. options are always reset in between each crontab entry (so no, they don't carry over, don't even try it). these options include most of the ones available to the sbatch command β€” full deets live in the sbatch(1) man page.

🚨 real talk bestie: jobs are not guaranteed to execute at the preferred time. jobs will run no more frequently than requested, but they're managed by setting the BeginTime field to the next valid iteration, and then they're subject to queuing delays. the exact behavior will depend on the local site configuration.

because of this method of implementation, the next job in the series won't be submitted until after the previous job has completed πŸ‘€. for example: say you've got a monitoring job scheduled to run every minute on a busy system. if the job scheduled to start at 08:20:00 isn't able to start until 08:20:30 and it runs for 35 seconds, then the job at 08:21:00 will be skipped, and the next job will be scheduled for 08:22:00. no cap, that's just how it works.

scrontab uses the same syntax for date and time specifiers as cron. each line has five fields, and here's what they mean:

  • minute β€” allowed values 0-59
  • hour β€” allowed values 0-23
  • day of month β€” allowed values 1-31
  • month β€” allowed values 1-12 (or name)
  • day of week β€” allowed values 0-7 (0 and 7 are Sunday, or use name)

a field can contain an asterisk (*) which means that it's valid for each of the allowed values for that time period. ranges are allowed β€” a range is two numbers with a hyphen between them, and the second number must be greater than the first. lists are allowed too, with commas separating the numbers or ranges. step values can be specified by entering a slash (/) followed by the step value, causing the job to run at the specified interval appropriate for that field. slay.

custom variables can be defined as within a regular shell script 🌸. the $ character introduces variable expansion. simple parameter expansion is the only currently accepted expansion variant (i.e. ${parameter} or ${parameter:-word} are not supported). the variable expansion will only occur within scrontab job commands. it is not possible to expand variables in other type of lines (other variable definitions, comments or crontab entries). the expansion will happen before submitting the job, but the variable definitions will remain in the scrontab script. and unlike crontab, the user environment variables are ignored πŸ’€.


✨ OPTIONS ✨

the first form of this command is used to install a new crontab from some named file, or from standard input if the pseudo-filename - is given.

  • -e β€” edit the crontab. if a crontab does not exist already, a default example (without any defined entries) will be provided in the editor πŸŽ€
  • -l β€” list the crontab. (prints directly to stdout.)
  • -r β€” remove the crontab. any currently running crontab-defined jobs will continue to run but will no longer recur. all other crontab-defined jobs will be cancelled ⚠️
  • -u <user> β€” edit or view a different user's crontab. listing is permitted for Operators and Admins. editing/removal is only permitted for root and the SlurmUser account. πŸ”

✨ SCRONTAB OPTIONS ✨

scrontab lets you use shortcuts to specify some common time intervals for the specified script to run 😌. these include the following:

  • @yearly | @annually β€” job will become eligible at 00:00 Jan 01 each year.
  • @monthly β€” job will become eligible at 00:00 on the first day of each month.
  • @weekly β€” job will become eligible at 00:00 Sunday of each week.
  • @daily | @midnight β€” job will become eligible at 00:00 each day.
  • @hourly β€” job will become eligible at the first minute of each hour.
  • @elevenses β€” job will become eligible at 11:00 each day. (this is a non-standard extension.) πŸ«–
  • @fika β€” job will become eligible at 15:00 each day. (this is a non-standard extension.) β˜•
  • @teatime β€” job will become eligible at 16:00 each day. (this is a non-standard extension.) 🍡

✨ ENVIRONMENT VARIABLES ✨

  • VISUAL β€” used as the interactive editor if set.
  • EDITOR β€” used as the interactive editor if set and VISUAL is not defined.
  • SLURM_CONF β€” the location of the Slurm configuration file.
  • SLURM_DEBUG_FLAGS β€” specify debug flags for scrontab to use. see DebugFlags in the slurm.conf(5) man page for a full list of flags. the environment variable takes precedence over the setting in the slurm.conf.

✨ NOTES ✨

  • scrontab is only available if the ScronParameters=enable option has been enabled in the slurm.conf πŸ‘‘
  • scrontab will create a temporary file in the directory set by the TMPDIR environment variable. if the variable is not set, /tmp is used.
  • jobs created with scrontab are assigned a single job id. when cancelled, all future runs of the job will also be cancelled. the job definition will be commented out in the user's scrontab file.
  • using scontrol requeue <job_id> will skip the next run of the cron job and reschedule it for the next available time based on the cron expression πŸ”

✨ EXAMPLES ✨

to create a job that would run at the beginning of each hour, using the 'high' partition, 'sub1' account and have a walltime of 1 minute, you would add the following to scrontab:

DIR=/home/user1
#SCRON -p high
#SCRON -A sub1
#SCRON -t 1:00
@hourly $DIR/date.printer.job

to have a job run every Wednesday, every other hour during the work day, each of the first five minutes of the hour and again at the thirty minute mark, you would add the following to scrontab:

1-5,30 8-17/2 * * wed $DIR/example.job

✨ LIMITATIONS ✨

the Slurm controller's timezone is what will be used to evaluate each crontab's repetition intervals 🌍. user-specific timezones are not supported.


✨ COPYING ✨

Copyright (C) 2020-2022 SchedMD LLC.

this file is part of Slurm, a resource management program. for details, see <https://slurm.schedmd.com/>.

Slurm is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Slurm is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. see the GNU General Public License for more details. πŸ“œ


✨ SEE ALSO ✨

sbatch(1), squeue(1), slurm.conf(5)


and that's the whole page bestie!! 🫢 this was Slurm 26.05, hanging out in the Slurm Commands corner of the manual. go schedule something cute. periodt πŸ’…βœ¨πŸŒˆ

πŸ“¦ where this page comes from