1scrontab(1) Slurm Commands scrontab(1)
2
3
4
6 scrontab - manage Slurm crontab files
7
8
10 scrontab [-u user] file
11 scrontab [-u user] [ -e | -l | -r ]
12
13
15 scrontab is used to set, edit, and remove a user's Slurm-managed
16 crontab. This file can define a number of recurring batch jobs to run
17 on a scheduled interval.
18
19 Lines must be either comments starting with '#', whitespace, valid
20 crontab entries or custom variable settings.
21
22 Lines starting with #SCRON allow options to be defined for the single
23 following crontab entry. Options are always reset in between each
24 crontab entry. Options include most of those available to the sbatch
25 command; details are available in the sbatch(1) man page.
26
27 Note that jobs are not guaranteed to execute at the preferred time.
28 Jobs will run no more frequently than requested, but are managed by
29 setting the BeginTime field to the next valid iteration, and are then
30 subject to queuing delays. The exact behavior will depend on the local
31 site configuration. Because of this method of implementation, the next
32 job in the series won't be submitted until after the previous job has
33 completed. For example, if you have a monitoring job that is scheduled
34 to run every minute on a busy system, if the job scheduled to start at
35 08:20:00 isn't able to start until 08:20:30 and it runs for 35 seconds
36 then the job at 08:21:00 will be skipped and the next job will be
37 scheduled for 08:22:00.
38
39 scrontab uses the same syntax for date and time specifiers as cron.
40 Each line has five fields that have the following meanings:
41 field allowed values
42 ----- --------------
43 minute 0-59
44 hour 0-23
45 day of month 1-31
46 month 1-12 (or name)
47 day of week 0-7 (0 and 7 are Sunday, or use name)
48
49
50 A field can contain an asterisk (*) which means that it's valid for
51 each of the allowed values for the given time period. Ranges are al‐
52 lowed where a range is two numbers with a hyphen between them. The
53 second number must be greater than the first. Lists are allowed, with
54 commas separating the numbers or ranges being separated. Step values
55 can be specified by entering a slash (/), followed by the step value,
56 causing the job to run at the specified interval appropriate for that
57 field.
58
59
60 Custom variables can be defined as within a regular shell script. The
61 `$' character introduces variable expansion. Simple parameter expansion
62 is the only currently accepted expansion variant (i.e. ${parameter} or
63 ${parameter:-word} are not supported). The variable expansion will only
64 occur within scrontab job commands. It is not possible to expand vari‐
65 ables in other type of lines (other variable definitions, comments or
66 crontab entries). The expansion will happen before submitting the job,
67 but the variable definitions will remain in the scrontab script. Unlike
68 crontab, the user environment variables are ignored.
69
70
72 The first form of this command is used to install a new crontab from
73 some named file or standard input if the pseudo-filename ``-'' is
74 given.
75
76
77 -e Edit the crontab. If a crontab does not exist already, a default
78 example (without any defined entries) will be provided in the
79 editor.
80
81 -l List the crontab. (Prints directly to stdout.)
82
83 -r Remove the crontab. Any currently running crontab-defined jobs
84 will continue to run but will no longer recur. All other
85 crontab-defined jobs will be cancelled.
86
87 -u <user>
88 Edit or view a different user's crontab. Listing is permitted
89 for Operators and Admins. Editing/removal is only permitted for
90 root and the SlurmUser account.
91
93 scrontab allows you to use shortcuts to specify some common time inter‐
94 vals for the specified script to run. These include the following:
95
96
97 @yearly | @annually
98 Job will become eligible at 00:00 Jan 01 each year.
99
100 @monthly
101 Job will become eligible at 00:00 on the first day of each
102 month.
103
104 @weekly
105 Job will become eligible at 00:00 Sunday of each week.
106
107 @daily | @midnight
108 Job will become eligible at 00:00 each day.
109
110 @hourly
111 Job will become eligible at the first minute of each hour.
112
114 VISUAL Used as the interactive editor if set.
115
116 EDITOR Used as the interfactive editor if set and VISUAL
117 is not defined.
118
119 SLURM_CONF The location of the Slurm configuration file.
120
121 SLURM_DEBUG_FLAGS Specify debug flags for scrontab to use. See De‐
122 bugFlags in the slurm.conf(5) man page for a full
123 list of flags. The environment variable takes
124 precedence over the setting in the slurm.conf.
125
127 scrontab is only available if the ScronParameters=enable option has
128 been enabled in the slurm.conf.
129
130 scrontab will create a temporary file in the directory set by TMPDIR
131 environment variable. If the variable is not set /tmp is used.
132
133 Jobs created with scrontab are assigned a single job id. When cancelled
134 all future runs of the job will also be cancelled. The job definition
135 will be commented out in the users scrontab file.
136
137
139 To create a job that would run at the beginning of each hour, using the
140 'high' partition, 'sub1' account and have a walltime of 1 minute, you
141 would add the following to scrontab:
142
143 DIR=/home/user1
144 #SCRON -p high
145 #SCRON -A sub1
146 #SCRON -t 1:00
147 @hourly $DIR/date.printer.job
148
149
150 To have a job run every Wednesday, every other hour during the work
151 day, each of the first five minutes of the hour and again at the thirty
152 minute mark, you would add the following to scrontab.
153
154 1-5,30 8-17/2 * * wed $DIR/example.job
155
156
158 The Slurm controller's timezone is what will be used to evaluate each
159 crontab's repetition intervals. User-specific timezones are not sup‐
160 ported.
161
162
164 Copyright (C) 2020-2022 SchedMD LLC.
165
166 This file is part of Slurm, a resource management program. For de‐
167 tails, see <https://slurm.schedmd.com/>.
168
169 Slurm is free software; you can redistribute it and/or modify it under
170 the terms of the GNU General Public License as published by the Free
171 Software Foundation; either version 2 of the License, or (at your op‐
172 tion) any later version.
173
174 Slurm is distributed in the hope that it will be useful, but WITHOUT
175 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
176 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
177 for more details.
178
179
181 sbatch(1), squeue(1), slurm.conf(5)
182
183
184
185October 2022 Slurm Commands scrontab(1)