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
122 scrontab is only available if the ScronParameters=enable option has
123 been enabled in the slurm.conf.
124
125 scrontab will create a temporary file in the directory set by TMPDIR
126 environment variable. If the variable is not set /tmp is used.
127
128 Jobs created with scrontab are assigned a single job id. When cancelled
129 all future runs of the job will also be cancelled. The job definition
130 will be commented out in the users scrontab file.
131
132
134 To create a job that would run at the beginning of each hour, using the
135 'high' partition, 'sub1' account and have a walltime of 1 minute, you
136 would add the following to scrontab:
137
138 DIR=/home/user1
139 #SCRON -p high
140 #SCRON -A sub1
141 #SCRON -t 1:00
142 @hourly $DIR/date.printer.job
143
144
145 To have a job run every Wednesday, every other hour during the work
146 day, each of the first five minutes of the hour and again at the thirty
147 minute mark, you would add the following to scrontab.
148
149 1-5,30 8-17/2 * * wed $DIR/example.job
150
151
153 The Slurm controller's timezone is what will be used to evaluate each
154 crontab's repetition intervals. User-specific timezones are not sup‐
155 ported.
156
157
159 Copyright (C) 2020-2022 SchedMD LLC.
160
161 This file is part of Slurm, a resource management program. For de‐
162 tails, see <https://slurm.schedmd.com/>.
163
164 Slurm is free software; you can redistribute it and/or modify it under
165 the terms of the GNU General Public License as published by the Free
166 Software Foundation; either version 2 of the License, or (at your op‐
167 tion) any later version.
168
169 Slurm is distributed in the hope that it will be useful, but WITHOUT
170 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
171 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
172 for more details.
173
174
176 sbatch(1), squeue(1), slurm.conf(5)
177
178
179
180October 2022 Slurm Commands scrontab(1)