]> granicus.if.org Git - fcron/blob - doc/en/fcrontab.5.sgml
Updated copyright years to 2013
[fcron] / doc / en / fcrontab.5.sgml
1 <!-- 
2 Fcron documentation
3 Copyright 2000-2013 Thibault Godouet <fcron@free.fr>
4 Permission is granted to copy, distribute and/or modify this
5 document under the terms of the GNU Free Documentation License,
6 Version 1.1 or any later version published by the Free Software
7 Foundation.
8 A copy of the license is included in gfdl.sgml.
9 -->
10
11
12 <refentry id="fcrontab.5">
13     <refmeta>
14         <refentrytitle>fcrontab</refentrytitle>
15         <manvolnum>5</manvolnum>
16         <refmiscinfo>Fcron &version; <![%devrelease; [
17 (<emphasis>development</emphasis> release)]]></refmiscinfo>
18         <refmiscinfo>&date;</refmiscinfo>
19     </refmeta>
20     <refnamediv>
21         <refname>fcrontab</refname>
22         <refpurpose>tables for driving fcron</refpurpose>
23     </refnamediv>
24
25     <refsect1>
26         <title>Description</title>
27         <para>A &fcrontabf; is a file containing all tables used by the
28 &fcron;(8) daemon. In other words, it is the means for a user to tell the daemon
29 "execute this command at this moment". Each user has his own &fcrontabf;, whose
30 commands are executed as his owner (only root can run a job as another using the
31 option &optrunas; (see below)).</para>
32         <para>Blank lines, line beginning by a hash sign (#) (which are
33 considered comments), leading blanks and tabs are ignored. Each line in a
34 fcrontab file can be either</para>
35         <itemizedlist>
36             <listitem>
37                 <para>an environment setting,</para>
38             </listitem>
39             <listitem>
40                 <para>an option setting,</para>
41             </listitem>
42             <listitem>
43                 <para>entries based on elapsed system up time,</para>
44             </listitem>
45             <listitem>
46                 <para>entries based on absolute time (like normal crontab
47 entries), or</para>
48             </listitem>
49             <listitem>
50                 <para>entries run periodically.</para>
51             </listitem>
52         </itemizedlist>
53         <para>Any logical line (an entry or an assignment) can be divided into
54 several real lines (the lines which end by a newline character) by placing a
55 backslash (\) before the newline character (\n).</para>
56
57         <refsect2>
58             <title>The environment settings</title>
59             <para>The environment settings are of the form</para>
60             <blockquote>
61                 <para>name = value</para>
62             </blockquote>
63             <para>where the blanks around equal-sign (=) are ignored and
64 optional. Trailing blanks are also ignored, but you can place the value in
65 quotes (simple or double, but matching) to preserve any blanks in the
66 value.</para>
67             <para>When &fcron; executes a command, it always sets
68 <envar>USER</envar>, and <envar>HOME</envar> as defined in
69 <filename>/etc/passwd</filename> for the owner of the &fcrontabf; from which the
70 command is extracted. TZ is also defined to the value of the option timezone when this option is used. It also defines <envar>SHELL</envar> to the value of the SHELL used to run the command. &Fcron; uses the value of <envar>SHELL</envar> from the fcrontab if any, otherwise it uses the value from <filename>fcron.conf</filename> if any, or in last resort the value from <filename>/etc/passwd</filename>. <envar>HOME</envar> and <envar>SHELL</envar> may be
71 overridden by settings in the &fcrontabf;, but <envar>USER</envar> may not.
72 Every other environment assignments defined in the user &fcrontabf; are then
73 made, and the command is executed.</para>
74             <para>By default, fcron will send emails using the email "Content-Type:" header of "text/plain" with the "charset=" parameter set to the charmap / codeset of the locale in which <link linkend="fcron.8">&fcron;(8)</link> is started up - i.e. either the default system locale, if no LC_* environment variables are set, or the locale specified by the LC_* environment variables (see locale(7)). You can use different character encodings for emailed fcron job output by setting the CONTENT_TYPE and CONTENT_TRANSFER_ENCODING variables in fcrontabs, to the correct values of the mail headers of those names.</para>
75             <para>Plus, the special variable <varname>MAILTO</varname> allows
76 you to tell &fcron; to whom it has to mail the command's output. Note that
77 <varname>MAILTO</varname> is in fact equivalent to a global declaration of the
78 option &optmailto; (see below). It is only used for backward compatibility, so
79 you should use the option &optmailto; directly.
80 </para>
81         </refsect2>
82
83         <refsect2 id="uptent">
84             <title>Entries based on elapsed system up time</title>
85             <para>The entries of commands which have to be run once every m
86 minutes of &fcron;'s execution (which is normally the same as m minutes of
87 system's execution) are of the form</para>
88             <programlisting>@options frequency command</programlisting>
89             <para>where frequency is a time value of the form
90 value*multiplier+value*multiplier+...+value-in-minutes as "12h02" or "3w2d5h1".
91 The first means "12 hours and 2 minutes of fcron execution" while the second
92 means "3 weeks, 2 days, 5 hours and 1 minute of fcron execution". The only valid
93 multipliers are:</para>
94             <table>
95                 <title>Valid time multipliers</title>
96                 <tgroup cols="2">
97                     <thead>
98                         <row>
99                             <entry>meaning: </entry>
100                             <entry>multipliers:      </entry>
101                         </row>
102                     </thead>
103                     <tbody>
104                         <row>
105                             <entry>months (4 weeks): </entry>
106                             <entry>m      </entry>
107                         </row>
108                         <row>
109                             <entry>weeks (7 days): </entry>
110                             <entry>w      </entry>
111                         </row>
112                         <row>
113                             <entry>days (24 hours): </entry>
114                             <entry>d      </entry>
115                         </row>
116                         <row>
117                             <entry>hours (60 minutes): </entry>
118                             <entry>h  </entry>
119                         </row>
120                         <row>
121                             <entry>seconds: </entry>
122                             <entry>s  </entry>
123                         </row>
124                     </tbody>
125                 </tgroup>
126             </table>
127
128             <para>In place of <replaceable>options</replaceable>, user can put a
129 time value: it will be interpreted as
130 <token>@first(<replaceable>time</replaceable>)</token>. If &optfirst; option is
131 not set, the value of "<varname>frequency</varname>" is used.</para>
132             <para>This kind of entry does not guarantee a time and date of
133 execution (as the job is delayed at each startup by the time elapsed since the
134 shutdown), but should be useful for jobs depending on the number of things done
135 by the users (for instance, the filesystem should better be checked after a
136 certain amount of use by the users rather than every x days, as the system may
137 run from 1 day to x days during that x days interval).</para>
138             <para>The time remaining before next execution is saved every &save;
139 seconds (to limit damages caused by a crash) and when &fcron; exits after having
140 received a <constant>SIGTERM</constant> signal, i.e. when systems go down. Thus,
141 this kind of entries is particularly useful for systems that don't run
142 regularly. The syntax being very simple, it may also useful for tasks which
143 don't need to be run at a specific time and date.</para>
144             <para>&seealso; options &optfirst;, &optmail;, &optnolog;,
145 &optserial;, &optlavg;, &optnice;, &optrunas; (see below).</para>
146             <para><example>
147                     <title>Some examples of lines based on elapsed system up
148 time</title>
149                     <programlisting>
150 # Get our mails every 30 minutes 
151 @ 30 getmails -all 
152
153 # make some security tests every 48 hours of system up time, 
154 # force a mail to be sent to root even if there is no output 
155 @mailto(root),forcemail 2d /etc/security/msec/cron-sh/security.sh
156 </programlisting>
157                 </example></para>
158         </refsect2>
159
160         <refsect2 id="fcrontab.5.tadent">
161             <title>Entries based on time and date</title>
162             <para>The second type of &fcrontabf;'s entries begins by an optional
163 "&", which can be immediately followed by an optional number defining the
164 frequency of execution (this is equivalent to option &optrunfreq;) or a
165 declaration of options; it has five time and date fields, and a shell command
166 :</para>
167             <programlisting>
168 &amp;options min hrs day-of-month month day-of-week command
169 </programlisting>
170             <para>Note that the shell command may be preceded by a user name,
171 which is equivalent to <token>runas(<replaceable>user</replaceable>)</token>: as
172 it is only here for backward compatibility you should use option &optrunas; (see
173 below) instead. The frequency is interpreted as: "run this command after x
174 matches of time and date fields". The time and date fields are:</para>
175             <table>
176                 <title>Time and date fields</title>
177                 <tgroup cols="2">
178                     <thead>
179                         <row>
180                             <entry>field: </entry>
181                             <entry>allowed values:      </entry>
182                         </row>
183                     </thead>
184                     <tbody>
185                         <row>
186                             <entry>minute: </entry>
187                             <entry>0-59      </entry>
188                         </row>
189                         <row>
190                             <entry>hour: </entry>
191                             <entry>0-23      </entry>
192                         </row>
193                         <row>
194                             <entry>day of month: </entry>
195                             <entry>1-31      </entry>
196                         </row>
197                         <row>
198                             <entry>month: </entry>
199                             <entry>1-12 (or names, see below)      </entry>
200                         </row>
201                         <row>
202                             <entry>day of week: </entry>
203                             <entry>0-7 (0 and 7 are both Sunday, or names)
204 </entry>
205                         </row>
206                     </tbody>
207                 </tgroup>
208             </table>
209             <para>A field is always filled by either an asterisk (*), which acts
210 as "<token>first-last</token>" range, a single number or a list.</para>
211             <para>List are numbers or range separated with commas (,). For
212 instance: "2,5,15,23".</para>
213             <para>Ranges of number are of the form
214 "<token><replaceable>begin</replaceable>-<replaceable>end</replaceable></token>", 
215 where "<replaceable>begin</replaceable>" and "<replaceable>end</replaceable>"
216 are included. For example, "3-5" specifies the values 3, 4 and 5. You can also
217 add an optional "/<replaceable>number</replaceable>" to a range, where the
218 <replaceable>number</replaceable> specifies skips of the
219 <replaceable>number</replaceable>'s value through the range. For example,
220 "0-23/2" can be used in the hours field to specify command execution every other
221 hour. Finally, one or several "~<replaceable>number</replaceable>" can be added
222 to turn off some specific values in a range. For example, "5-8~6~7" is equivalent to
223 "5,8". The final form of a field is:</para>
224             <blockquote>
225                 <para>a[-b[/c][~d][~e][...]][,f[-g[/h][~i][~j][...]]][,...]</para>
226             </blockquote>
227             <para>where the letters are integers.</para>
228             <para>You can also use an asterisk (*) in a field. It acts for
229 "<token>first-last</token>". For example, a "*" in the field minute means all
230 minutes from minute 0 down to minute 59.</para>
231             <para>Ranges can be included in a list as a single number. For
232 instance: "2,5-10/2~6,15,20-25,30".</para>
233             <para>Names can also be used for the "month" and "day of week"
234 fields. To do so, use the first three letters of the particular day or month
235 (case doesn't matter). Please note that names are used exactly as numbers: you
236 can use them in a list or a range.</para>
237             <para>If a day of month and a day of week are given, the command
238 will execute only when <emphasis>both</emphasis> match with the current time and
239 date unless option &optdayor; is set. For example, with the line
240 <programlisting>5 10 31 * 7 echo ''</programlisting> echo will only be executed
241 days which are a Sunday AND a 31th, at 10:05.</para>
242             <para>&seealso; options &optdayor;, &optbootrun;, &optrunfreq;,
243 &optmail;, &optnolog;, &optserial;, &optlavg;, &optnice;, &optrunas; (see
244 below).</para>
245             <para><example>
246                     <title>Some examples of entries based on time and date</title>
247                     <programlisting>
248 # run mycommand at 12:05, 12:35, 13:05, 13:35, 
249 # 14:05 *and* 14:35 everyday 
250 &amp; 05,35 12-14 * * * mycommand -u me -o file 
251
252 # get mails every hour past 20, 21, 22, and 24 minutes. 
253 20-24~23 * * * * getmail 
254
255 # save our work of the day every night at 03:45 with a low priority 
256 # unless we are sunday, mail the output to jim and run that job 
257 # at startup if computer was down at 03:45
258 &amp;nice(10),mailto(jim),bootrun 45 03 * * *~0 "save --our work" 
259 </programlisting>
260                 </example></para>
261         </refsect2>
262
263         <refsect2 id="fcrontab.5.periodent">
264             <title>Entries run periodically</title>
265             <para>The third type of &fcrontabf;'s entries begin by a "%",
266 followed by a keyword from one of 3 different lists, and optional options.</para>
267                 <refsect3>
268                     <title>*ly keywords</title>
269                     <para>Those keywords are:</para>
270                     <para><simplelist type="inline">
271                             <member><parameter>hourly </parameter></member>
272                             <member><parameter>daily </parameter></member>
273                             <member><parameter>monthly </parameter></member>
274                             <member><parameter>weekly </parameter></member>
275                         </simplelist></para>
276                     <para>Those keywords tell &fcron; to run the command
277 once from the beginning of the corresponding time interval to the end of that
278 time interval. A time interval is, for example, the time from Monday 16:20 to Wednesday 01h43.
279 For instance, the keyword <parameter>weekly</parameter> tells &fcron;
280 to run a command once between Monday and Sunday each week.</para>
281             <para>With this two kind of keywords, user must give the needed time
282 fields (as defined in "<link linkend="fcrontab.5.tadent">Entries based on time
283 and date</link>" (see above)) to specify when the command should be run during
284 each time interval:</para>
285                     <para>
286             <table>
287                 <title>Needed time fields for each keyword</title>
288                 <tgroup cols="2">
289                     <thead>
290                         <row>
291                             <entry>Keywords: </entry>
292                             <entry>must be followed by the fields: </entry>
293                         </row>
294                     </thead>
295                     <tbody>
296                         <row>
297                             <entry><parameter> hourly</parameter>,
298 <parameter>midhourly</parameter>: </entry>
299                             <entry> minutes.</entry>
300                         </row>
301                         <row>
302                             <entry><parameter> daily</parameter>,
303 <parameter>middaily</parameter>, <parameter>nightly</parameter>,
304 <parameter>weekly</parameter>, <parameter>midweekly</parameter>: </entry>
305                             <entry> minutes and hours.</entry>
306                         </row>
307                         <row>
308                             <entry><parameter> monthly</parameter>,
309 <parameter>midmonthly</parameter>: </entry>
310                             <entry> minutes, hours and days.</entry>
311                         </row>
312                     </tbody>
313                 </tgroup>
314             </table>
315 </para>
316                 </refsect3>
317
318                 <refsect3>
319                     <title>mid*ly keywords</title>
320                     <para>They are similar to the "*ly" ones:</para>
321                     <para><simplelist type="inline">
322                             <member><parameter>midhourly </parameter></member>
323                             <member><parameter>middaily </parameter></member>
324                             <member><parameter>nightly </parameter></member>
325                             <member><parameter>midmonthly </parameter></member>
326                             <member><parameter>midweekly </parameter></member>
327                         </simplelist></para>
328                     <para>They work exactly has the "*ly" keywords, except
329 that the time intervals are defined from middle to middle of the corresponding
330 "*ly" intervals: <parameter>midweekly</parameter> will run a command once from
331 Thursday to Wednesday. Note that <parameter>nightly</parameter> is equivalent to
332 <parameter>middaily</parameter>.</para>
333             <para>For example:
334             <informalexample>
335                     <programlisting>
336 %nightly,mail(no) * 21-23,3-5 echo "a nigthly entry"
337 </programlisting>
338                 </informalexample></para>
339             <para>will run the command once each night either between 21:00 and
340 23:59, or between 3:00 and 5:59 (it will run as soon as possible. To change
341 that, use option &optrandom;) and won't send mail (because option &optmail;
342 is set to "no").</para>
343             <para>&seealso; options &optlavg;, &optnoticenotrun;, &optstrict;,
344 &optmail;, &optnolog;, &optserial;, &optnice;, &optrunas;, &optrandom; (see
345 below).</para>
346                 </refsect3>
347
348
349                 <refsect3>
350                     <title>*s keywords</title>
351                     <para>They are:</para>
352                     <para><simplelist type="inline">
353                             <member><parameter>mins </parameter></member>
354                             <member><parameter>hours </parameter></member>
355                             <member><parameter>days </parameter></member>
356                             <member><parameter>mons </parameter></member>
357                             <member><parameter>dow </parameter></member>
358                         </simplelist></para>
359             <para>Those keywords act differently, as
360 follows:</para>
361             <para>run this command once during EACH time interval specified, ignoring
362 the fields below the keyword in the time interval definition (a
363 <parameter>hours</parameter> prevents the mins field to be considered as a time
364 interval, but it will be used to determine when the line should be run during an
365 interval: see the note below) (<parameter>dow</parameter> means "day of
366 week").</para>
367             <para>Such a keyword is followed by 5 time and date fields (the same
368 fields used for a <link linkend="fcrontab.5.tadent">line based on absolute
369 time</link> (see above)). Furthermore, there must be some non-matching time and
370 dates in the lines with that kind of keyword (i.e. the following is not allowed
371 : <programlisting>%hours * 0-23 * * * echo "INCORRECT line!"</programlisting>
372 but <programlisting>%hours * 0-22 * * * echo "Ok."</programlisting> is
373 allowed).</para>
374             <note>
375                 <para>a single number in a field is considered as a time interval:
376 <programlisting>%mins 15 2-4 * * * echo</programlisting> will run at 2:15, 3:15
377 AND 4:15 every day.</para>
378                 <para>But all fields below the keywords are ignored in time
379 interval definition: <programlisting>%hours 15 2-4 * * * echo</programlisting>
380 will run only ONCE either at 2:15, 3:15 OR 4:15.</para>
381             </note>
382             <para>&seealso; option &optrandom; (see below).</para>
383
384                 </refsect3>
385
386         </refsect2>
387
388         <refsect2 id="fcrontab.5.shortcuts">
389             <title>Vixie cron shortcuts</title>
390             <para>To ensure a good compatibility with Vixie cron, Vixie cron shortcuts are supported. Generally speaking their usage is not recommended as they lack some of the flexibility brought by fcron. Also where the precise time of execution is not critical, the use <link
391 linkend="uptent">lines based on elapsed system up time</link> is recommended instead.</para>
392             <para>A task using a Vixie cron shortcut is of the form:</para>
393             <programlisting>shortcut command</programlisting>
394             <para>Below is a list of available shortcuts with their fcron equivalent:</para>
395             <table>
396                 <title>Vixie cron shortcuts </title>
397                 <tgroup cols="2">
398                     <thead>
399                         <row>
400                             <entry>shortcut: </entry>
401                             <entry>meaning: </entry>
402                             <entry>fcron equivalent: </entry>
403                             <entry>suggested alternative: </entry>
404                         </row>
405                     </thead>
406                     <tbody>
407                         <row>
408                             <entry>@reboot </entry>
409                             <entry>Run once, at startup </entry>
410                             <entry>@runatreboot,runonce(true)</entry>
411                             <entry>   </entry>
412                         </row>
413                         <row>
414                             <entry>@yearly </entry>
415                             <entry>Run once a year </entry>
416                             <entry>0 0 1 1 * </entry>
417                             <entry>@ 12m </entry>
418                         </row>
419                         <row>
420                             <entry>@annually </entry>
421                             <entry>(same as @yearly) </entry>
422                             <entry>0 0 1 1 * </entry>
423                             <entry>@ 12m </entry>
424                         </row>
425                         <row>
426                             <entry>@monthly </entry>
427                             <entry>Run once a month </entry>
428                             <entry>0 0 1 * * </entry>
429                             <entry>@ 1m </entry>
430                         </row>
431                         <row>
432                             <entry>@weekly </entry>
433                             <entry>Run once a week </entry>
434                             <entry>0 0 * * 0 </entry>
435                             <entry>@ 1w </entry>
436                         </row>
437                         <row>
438                             <entry>@daily </entry>
439                             <entry>Run once a day </entry>
440                             <entry>0 0 * * * </entry>
441                             <entry>@ 1d </entry>
442                         </row>
443                         <row>
444                             <entry>@midnight </entry>
445                             <entry>(same as @daily) </entry>
446                             <entry>0 0 * * * </entry>
447                             <entry> </entry>
448                         </row>
449                         <row>
450                             <entry>@hourly </entry>
451                             <entry>Run once an hour </entry>
452                             <entry>0 * * * * </entry>
453                             <entry>@ 1h </entry>
454                         </row>
455                     </tbody>
456                 </tgroup>
457             </table>
458
459
460             <para>A few examples:</para>
461             <programlisting># run check_laptop_logs.sh at the first minute of every hour:
462 @hourly check_laptop_logs.sh
463 # run check_web_server.sh and check_file_server.sh every day at exactly
464 # midnight, both at the same time:
465 @daily check_web_server.sh
466 @daily check_file_server.sh
467 # run compress_home_made_app_log_files.sh at exactly midnight
468 # on the first day of every month:
469 @monthly compress_home_made_app_log_files.sh</programlisting>
470             <para>However you might want to replace those task definitions by something as:</para>
471             <programlisting># run check_laptop_logs.sh after every hour of system up time:
472 @ 60 check_laptop_logs.sh
473 # run check_web_server.sh and check_file_server.sh every night between midnight
474 # and 3am, one by after the other:
475 %nightly,serial * 0-3 check_web_server.sh
476 %nightly,serial * 0-3 check_file_server.sh
477 # Run compress_home_made_app_log_files.sh once a month, only at night
478 # when the load is low:
479 @monthly,lavg(0.5) * 21-23,0-5 * compress_home_made_app_log_files.sh</programlisting>
480
481
482             <para>Last, but not least, it should be noted that tasks defined using a Vixie cron shortcut will only have the same behaviour as in Vixie cron if they are not modified by some earlier option definition. That will be the case if you import a Vixie cron crontab into fcron without modification, or if you precede the task definition by a &optreset;, e.g.:</para>
483             <programlisting>!serial
484 @ 10 fcron_task_1
485 @ 25 fcron_task_2
486 !reset
487 @reboot start_unprivileged_user_program
488 @daily cleanup_tmp.sh</programlisting>
489             <para>In the example above, &optserial; would apply to the last two tasks if we hadn't used &optreset;.</para>
490         </refsect2>
491
492
493
494         <refsect2>
495             <title>Options</title>
496             <para>The options can be set either for every line below the
497 declaration or for an individual line. In the first case, the setting is done on
498 a whole line immediately after an exclamation mark (!), while it is done after a
499 "&", a "%" or a "@" depending on the type of scheduling in the second case. Note
500 that an option declaration in a schedule overrides the global declaration of
501 that same option.</para>
502             <para>Options are separated by commas (,) and their arguments, if
503 any, are placed in parentheses ("(" and ")") and separated by commas. No space
504 or surrounding (double-)quote is allowed. A declaration of options is of the form</para>
505             <blockquote>
506                 <para><replaceable>option</replaceable>[(<replaceable>arg1</replaceable>[,<replaceable>arg2</replaceable>][...])][,<replaceable>option</replaceable>[(<replaceable>arg1</replaceable>[...])]][...]</para>
507             </blockquote>
508             <para>where option is either the name of an option or its
509 abbreviation. The options are (default value in parentheses):</para>
510             <variablelist>
511                 <title>Valid options in a &fcrontabf;</title>
512
513                 <varlistentry id="fcrontab.5.bootrun">
514                     <term>bootrun</term>
515                     <term>b</term>
516                     <listitem>
517                         <para><emphasis><type>boolean</type></emphasis>(<constant>false</constant>)</para>
518                         <para>Run an &-line at &fcron;'s startup if it should
519 have run during system down time.</para>
520                     </listitem>
521                 </varlistentry>
522
523                 <varlistentry id="fcrontab.5.dayand">
524                     <term>dayand</term>
525                     <listitem>
526                         <para><emphasis><type>boolean</type></emphasis>(<constant>true</constant>)</para>
527                         <para>Perform a logic AND between week and month
528 day.</para>
529                         <para>&seealso; options &optdayor;.</para>
530                     </listitem>
531                 </varlistentry>
532
533                 <varlistentry id="fcrontab.5.dayor">
534                     <term>dayor</term>
535                     <listitem>
536                         <para><emphasis><type>boolean</type></emphasis>(<constant>false</constant>)</para>
537                         <para>Perform a logic OR between week and month
538 day.</para>
539                         <para>&seealso; options &optdayand;.</para>
540                     </listitem>
541                 </varlistentry>
542
543                 <varlistentry id="fcrontab.5.erroronlymail">
544                     <term>erroronlymail</term>
545                     <listitem>
546                         <para><emphasis><type>boolean</type></emphasis>(<constant>false</constant>)</para>
547                         <para>Mail output only if job exited with a non-zero status.</para>
548                         <para>&seealso; options &optmail;, &optmailto;,
549 &optforcemail;, &optnolog;.</para>
550                     </listitem>
551                 </varlistentry>
552
553                 <varlistentry id="fcrontab.5.exesev">
554                     <term>exesev</term>
555                     <listitem>
556                         <para><emphasis><type>boolean</type></emphasis>(<constant>false</constant>)</para>
557                         <para>Can a job be executed several times simultaneously
558 ?</para>
559                         <para>&seealso; options &optserialonce;,
560 &optlavgonce;.</para>
561                     </listitem>
562                 </varlistentry>
563
564                 <varlistentry id="fcrontab.5.first">
565                     <term>first</term>
566                     <term>f</term>
567                     <listitem>
568                         <para><emphasis><type>time-value</type></emphasis></para>
569                         <para>Delay before first execution of a job based on
570 system up time ("@"-lines). Useful in the following case: you have several jobs
571 running, say, every hour. By setting different first value for each job, you can
572 avoid them to run simultaneously everytime. You can also set it to 0, which is
573 useful when used in conjunction with option &optvolatile;.</para>
574                     </listitem>
575                 </varlistentry>
576
577                 <varlistentry id="fcrontab.5.forcemail">
578                     <term>forcemail</term>
579                     <listitem>
580                         <para><emphasis><type>boolean</type></emphasis>(<constant>false</constant>)</para>
581                         <para>Mail output even if zero-length.</para>
582                         <para>Setting this option to true will also set &optmail; to true.</para>
583                         <para>&seealso; options &optmail;, &optmailto;,
584 &opterroronlymail;, &optnolog;.</para>
585                     </listitem>
586                 </varlistentry>
587
588                 <varlistentry id="fcrontab.5.jitter">
589                     <term>jitter</term>
590                     <listitem>
591                         <para><emphasis><type>integer</type></emphasis>(<constant>0</constant>)</para>
592                         <para>Run the task between 0 and jitter seconds later than it should have been run. This options only applies to &-lines and is intended for systems where many jobs are supposed to be started at the same minute: the jitter option will randomly spread the start of all those jobs across the first jitter seconds of the minute instead of starting all of them at the first second of the minute. The argument must be between 0 and 255 (inclusive).</para>
593                         <para>&seealso; option &optrandom;.</para>
594                     </listitem>
595                 </varlistentry>
596
597                 <varlistentry id="fcrontab.5.lavg">
598                     <term>lavg</term>
599                     <listitem>
600                         <para><emphasis><type>real</type></emphasis>(<constant>0</constant>) 
601 <emphasis><type>real</type></emphasis>(<constant>0</constant>)
602 <emphasis><type>real</type></emphasis>(<constant>0</constant>)</para>
603                         <para>Set the values of the 1, 5 and 15-minute (in this
604 order) system load average values below which the job should run. The values
605 have a maximum of 1 decimal (i.e. "2.3"): if there are more than 1 decimal, 
606 the value will be round off. Set a value to 0 to ignore the corresponding
607 load average (or all of the values to run the job regardless of the load
608 average).</para>
609                         <para>&seealso; options &optlavg1;, &optlavg5;,
610 &optlavg15;, &optuntil;, &optlavgonce;, &optlavgor;, &optlavgand;, &optstrict;,
611 &optnoticenotrun;.</para>
612                     </listitem>
613                 </varlistentry>
614                 <varlistentry id="fcrontab.5.lavgX">
615                     <term>lavg1</term>
616                     <term>lavg5</term>
617                     <term>lavg15</term>
618                     <listitem>
619                         <para><emphasis><type>real</type></emphasis>(<constant>0</constant>)</para>
620                         <para>Set the threshold of, respectively, the 1, 5 or 15
621 minutes system load average value. Set one of them to 0 to ignore the
622 corresponding load average.</para>
623                         <para>&seealso; options &optlavg;.</para>
624                     </listitem>
625                 </varlistentry>
626
627                 <varlistentry id="fcrontab.5.lavgand">
628                     <term>lavgand</term>
629                     <listitem>
630                         <para><emphasis><type>boolean</type></emphasis>(<constant>true</constant>)</para>
631                         <para>Perform a logic AND between the 1, 5 and 15
632 minutes system load average values.</para>
633                         <para>&seealso; options &optlavg;, &optlavgor;.</para>
634                     </listitem>
635                 </varlistentry>
636
637                 <varlistentry id="fcrontab.5.lavgonce">
638                     <term>lavgonce</term>
639                     <listitem>
640                         <para><emphasis><type>boolean</type></emphasis>(<constant>&lavgoncedef;</constant>)</para>
641                         <para>Can a job be queued several times in lavg queue
642 simultaneously?</para>
643                         <para>&seealso; options &optlavg;.</para>
644                     </listitem>
645                 </varlistentry>
646
647                 <varlistentry id="fcrontab.5.lavgor">
648                     <term>lavgor</term>
649                     <listitem>
650                         <para><emphasis><type>boolean</type></emphasis>(<constant>false</constant>)</para>
651                         <para>Perform a logic OR between the 1, 5 and 15 minutes
652 system load average values.</para>
653                         <para>&seealso; options &optlavg;, &optlavgand;.</para>
654                     </listitem>
655                 </varlistentry>
656
657                 <varlistentry id="fcrontab.5.mail">
658                     <term>mail</term>
659                     <term>m</term>
660                     <listitem>
661                         <para><emphasis><type>boolean</type></emphasis>(<constant>true</constant>)</para>
662                         <para>Mail output (if any) or not.</para>
663                         <para>Setting this option to false will also set &optforcemail; to false.</para>
664                         <para>&seealso; options &optmailto;, &optforcemail;,
665 &opterroronlymail;, &optnolog;.</para>
666                     </listitem>
667                 </varlistentry>
668
669                 <varlistentry id="fcrontab.5.mailto">
670                     <term>mailto</term>
671                     <listitem>
672                         <para><emphasis><type>email-address</type></emphasis>(<constant>name 
673 of file's owner</constant>)</para>
674                         <para>Mail output (if needed) to
675 "<replaceable>email-address</replaceable>". It can be either a single user-name
676 or a fully qualified email address. A &optmailto; declared and empty (string
677 "") is equivalent to "<token>mail(false)</token>".</para>
678                         <para>&seealso; options &optmail;, &optforcemail;,
679 &opterroronlymail;, &optnolog;.</para>
680                     </listitem>
681                 </varlistentry>
682
683                 <varlistentry id="fcrontab.5.nice">
684                     <term>nice</term>
685                     <term>n</term>
686                     <listitem>
687                         <para><emphasis><type>nice-value</type></emphasis></para>
688                         <para>Change job priority. A
689 <emphasis><type>nice-value</type></emphasis> is an integer from -20 (highest
690 priority) to 19 (lowest) (only root is allowed to use a negative value with this
691 option).</para>
692                     </listitem>
693                 </varlistentry>
694
695                 <varlistentry id="fcrontab.5.nolog">
696                     <term>nolog</term>
697                     <listitem>
698                         <para><emphasis><type>boolean</type></emphasis>(<constant>false</constant>)</para>
699                         <para>If set to true, log only errors for the
700 corresponding job(s). May be useful for jobs running very often, and/or to
701 reduce disk access on a laptop.</para>
702                         <para>&seealso; options &optmail;, &optmailto;,
703 &opterroronlymail;, &optforcemail;.</para>
704                     </listitem>
705                 </varlistentry>
706
707                 <varlistentry id="fcrontab.5.noticenotrun">
708                     <term>noticenotrun</term>
709                     <listitem>
710                         <para><emphasis><type>boolean</type></emphasis>(<constant>false</constant>)</para>
711                         <para>Should &fcron; mail user to report the
712 non-execution of a %-job or an &-job? (because of system down state for both or
713 a too high system load average for the latter)</para>
714                         <para>&seealso; options &optlavg;, &optstrict;.</para>
715                     </listitem>
716                 </varlistentry>
717
718                 <varlistentry id="fcrontab.5.random">
719                     <term>random</term>
720                     <listitem>
721                         <para><emphasis><type>boolean</type></emphasis>(<constant>false</constant>)</para>
722                         <para>In a <link linkend="fcrontab.5.periodent">line run
723 periodically</link>, this option answers the question: should this job be run
724 as soon as possible in its time interval of execution (safer), or should fcron set a
725 random time of execution in that time interval? Note that if this option is set, the
726 job may not run if fcron is not running during the <emphasis>whole</emphasis>
727 execution interval. Besides, you must know that the random scheme may be quite
728 easy to guess for skilled people: thus, you shouldn't rely on this option
729 to make important things secure. However, it shouldn't be a problem
730 for most uses.</para>
731                         <para>&seealso; option &optjitter;.</para>
732                     </listitem>
733                 </varlistentry>
734
735                 <varlistentry id="fcrontab.5.rebootreset">
736                     <term>rebootreset</term>
737                     <listitem>
738                         <para><emphasis><type>boolean</type></emphasis>(<constant>false</constant>)</para>
739                         <para>When set to true, fcron will act as if the task was
740 a new one every time the OS reboots. This is very similar to the option &optvolatile;
741 but based on the OS reboots instead of fcron restarts.
742 You may also want to use option &optfirst; if you use fcron that way.</para>
743                         <para>&seealso; options &optfirst;, &optvolatile;, &optrunonce;, &optrunatreboot;.</para>
744                     </listitem>
745                 </varlistentry>
746
747                 <varlistentry id="fcrontab.5.reset">
748                     <term>reset</term>
749                     <listitem>
750                         <para><emphasis><type>boolean</type></emphasis></para>
751                         <para>Reset all the options to default.</para>
752                     </listitem>
753                 </varlistentry>
754
755                 <varlistentry id="fcrontab.5.runas">
756                     <term>runas</term>
757                     <listitem>
758                         <para><emphasis><type>user-name</type></emphasis></para>
759                         <para>Run with "<replaceable>user-name</replaceable>"
760 permissions and environment (only root is allowed to use this option).</para>
761                     </listitem>
762                 </varlistentry>
763
764                 <varlistentry id="fcrontab.5.runatreboot">
765                     <term>runatreboot</term>
766                     <listitem>
767                         <para><emphasis><type>boolean</type></emphasis>(<constant>false</constant>)</para>
768                         <para>If set to true, the task will be run at system startup (i.e. immediately after the &argfirstsleep; delay -- by default, &firstsleep; seconds -- when the &fcron; daemon starts the first time after the OS has booted). This is in addition to the regular schedule which won't be modified by this option.</para>
769                         <para>For instance, if a program should be started automatically and run from 7am to 6pm, you could use the following dfcrontab definitions:</para>
770                         <programlisting>&amp;runatreboot 0 6 * * 1-5 start_my_program.sh
771 & 0 7 * * 1-5 stop_my_program.sh</programlisting>
772                         <para>&seealso; options &optvolatile;, &optrunonce;, &optrebootreset;.</para>
773                     </listitem>
774                 </varlistentry>
775
776                 <varlistentry id="fcrontab.5.runfreq">
777                     <term>runfreq</term>
778                     <term>r</term>
779                     <listitem>
780                         <para><emphasis><type>integer</type></emphasis></para>
781                         <para>Run every "<replaceable>runfreq</replaceable>"
782 matches of time and date. (this option is ignored for <link
783 linkend="uptent">lines based on elapsed system up time</link>).</para>
784                     </listitem>
785                 </varlistentry>
786
787                 <varlistentry id="fcrontab.5.runonce">
788                     <term>runonce</term>
789                     <listitem>
790                         <para><emphasis><type>boolean</type></emphasis>(<constant>false</constant>)</para>
791                         <para>Do not re-schedule the task after it has run once, until the next OS reboot (if &optvolatile; is not set) or until the next &fcron; daemon restart (if &optvolatile; is set).</para>
792                         <para>&seealso; options &optvolatile;, &optrebootreset;, &optrunatreboot;.</para>
793                     </listitem>
794                 </varlistentry>
795
796                 <varlistentry id="fcrontab.5.serial">
797                     <term>serial</term>
798                     <term>s</term>
799                     <listitem>
800                         <para><emphasis><type>boolean</type></emphasis>(<constant>false</constant>)</para>
801                         <para>&Fcron; runs at most &serialmaxrunning; serial
802 jobs (ie. for which the option serial is set to true), and the same number of lavg serial jobs (ie. for which both option serial and lavg (or lavg1 or lavg5 or lavg15) are set to true) simultaneously. This value may be modified by &fcron;'s option <option>-m</option>. This option is especially useful when used with big jobs in order to limit the system overload.</para>
803                         <para>&seealso; options &optserialonce;,
804 &optlavg;.</para>
805                     </listitem>
806                 </varlistentry>
807
808                 <varlistentry id="fcrontab.5.serialonce">
809                     <term>serialonce</term>
810                     <listitem>
811                         <para><emphasis><type>boolean</type></emphasis>(<constant>&serialoncedef;</constant>)</para>
812                         <para>Can a job be queued several times in serial queue
813 simultaneously?</para>
814                         <para>&seealso; options &optexesev;,
815 &optlavgonce;.</para>
816                     </listitem>
817                 </varlistentry>
818
819                 <varlistentry id="fcrontab.5.stdout">
820                     <term>stdout</term>
821                     <listitem>
822                         <para><emphasis><type>boolean</type></emphasis>(<constant>false</constant>)</para>
823                         <para>If fcron is running in the foreground, then also
824 let jobs print to stderr/stdout instead of mailing or discarding it.</para>
825                         <para>&seealso; fcron's option &argonce;
826 in <link linkend="fcron.8">&fcron;(8)</link>.</para>
827                     </listitem>
828                 </varlistentry>
829
830                 <varlistentry id="fcrontab.5.strict">
831                     <term>strict</term>
832                     <listitem>
833                         <para><emphasis><type>boolean</type></emphasis>(<constant>true</constant>)</para>
834                         <para>When a lavg %-job is at the end of a time interval of
835 execution, should it be removed from the lavg queue (strict(true), so the job is
836 not run) or be let there until the system load average allows its execution
837 (strict(false))?</para>
838                         <para>&seealso; options &optlavg;,
839 &optnoticenotrun;.</para>
840                     </listitem>
841                 </varlistentry>
842
843                <varlistentry id="fcrontab.5.timezone">
844                   <term>timezone</term>
845                   <listitem>
846                      <para><emphasis><type>timezone-name</type></emphasis>(<constant>time zone of the system</constant>)</para>
847                      <para>Run the job in the given time zone. timezone-name is a string which is valid for the environment variable TZ: see the documentation of your system for more details. For instance, "Europe/Paris" is valid on a Linux system. This option handles daylight saving time changes correctly. The TZ environment variable is set to the value of timezone when a job defining this option is run.</para>
848                      <para>Please note that if you give an erroneous timezone-name argument, it will be SILENTLY ignored, and the job will run in the time zone of the system.</para>
849                      <para>WARNING: do *not* use option timezone and option tzdiff simultaneously! There is no need to do so, and timezone is cleverer than tzdiff.</para>
850                      <para>&seealso; options &opttzdiff;.</para>
851                   </listitem>
852                </varlistentry>
853
854
855                 <varlistentry id="fcrontab.5.tzdiff">
856                     <term>tzdiff</term>
857                     <listitem>
858                         <para><emphasis><type>integer</type></emphasis>(<constant>0</constant>)</para>
859                      <para>WARNING: this option is deprecated: use option timezone instead!</para>
860                         <para>Time zone difference (in hours, between -24 and
861 24) between the system time, and the local real time. This option allows a user
862 to define its & and %-lines in the local time. Note that this value is set for a
863 whole fcrontab file, and only the last definition is taken into account. tzdiff is quite stupid: it doesn't handle daylight saving changes, while option timezone does, so you should use the latter.</para>
864                         <para>&seealso; options &opttimezone;.</para>
865                     </listitem>
866                 </varlistentry>
867
868                 <varlistentry id="fcrontab.5.until">
869                     <term>until</term>
870                     <listitem>
871                         <para><emphasis><type>time-value</type></emphasis>(<constant>0</constant>)</para>
872                         <para>Set the timeout of the waiting of the wanted
873 system load average values. If the timeout is exceeded, the job runs no matter
874 the load average. Set until to 0 to remove the timeout.</para>
875                         <para>&seealso; options &optlavg;.</para>
876                     </listitem>
877                 </varlistentry>
878
879                 <varlistentry id="fcrontab.5.volatile">
880                     <term>volatile</term>
881                     <listitem>
882                         <para><emphasis><type>boolean</type></emphasis>(<constant>false</constant>)</para>
883                         <para>When set to true, the job is based on a "volatile"
884 system up time, i.e. restart counting each time &fcron; is started, which is
885 useful when &fcron; is started by a script running only, for instance, during a
886 dialup connection: the "volatile" system up time then refers to the dialup
887 connection time. You may also want to use option &optfirst; if you use fcron
888 that way.</para>
889                         <para>&seealso; options &optfirst;, &optstdout;, &optrebootreset;,
890 <link linkend="uptent">lines based on elapsed system up time</link>, fcron's command line argument
891 &argonce; in <link linkend="fcron.8">&fcron;(8)</link>.</para>
892                     </listitem>
893                 </varlistentry>
894             </variablelist>
895
896             <para>A <type>boolean</type> argument can be non-existent, in which
897 case parentheses are not used and it means <constant>true</constant>; the string
898 "true", "yes" or 1 to mean <constant>true</constant>; and the string "false",
899 "no" or 0 to mean <constant>false</constant>. See above for explanations about
900 time value (section <link linkend="uptent">"entries based on elapsed system up
901 time"</link>).</para>
902             <para>Note that <varname>dayand</varname> and
903 <varname>dayor</varname> are in fact the same option: a false value to
904 <varname>dayand</varname> is equivalent to a true to <varname>dayor</varname>,
905 and reciprocally a false value to <varname>dayor</varname> is equivalent a true
906 value to <varname>dayand</varname>. It is the same for
907 <varname>lavgand</varname> and <varname>lavgor</varname>.</para>
908             <para>Note a special case to be handled: A job should be entered
909 into the serial queue, *but* the previous entry for this job has not been
910 completed yet, because of high system load or some external event. Option
911 <varname>serialonce</varname> answers the question: should the new entry of the
912 job be ignored? This way one can distinguish between jobs required to run a
913 certain number of times, preferably at specified times, and tasks to be
914 performed irrespective of their number (-> serialonce(true)), which make the
915 system respond faster.</para>
916             <para>The same considerations apply for the load average queue, and
917 can be expressed with option <varname>lavgonce</varname>.</para>
918             <para>Moreover, if the serial or the lavg queue contains
919 respectively more than &serialqueuemax; and &lavgqueuemax; jobs, any new job is
920 refused and not run to avoid an overwhelming of system resources. In this case,
921 an error message is logged through syslog.</para>
922             <para>Finally, if jobs remain in the lavg or serial queues when
923 fcron stops, they will be put once in the corresponding queue on startup (their
924 order may not be conserved).</para>
925             <para><example>
926                     <title>An example of an option declaration:</title>
927                     <programlisting>!reset,serial(true),dayor,bootrun(0),mailto(root),lavg(.5,2,1.5)</programlisting>
928                 </example></para>
929         </refsect2>
930
931     </refsect1>
932
933     <refsect1>
934         <title>Examples</title>
935         <para><example>
936                 <title>An example of a user fcrontab</title>
937                 <programlisting>
938 # use /bin/bash to run commands, ignoring what /etc/passwd says 
939 SHELL=/bin/bash
940
941 # mail output to thib, no matter whose fcrontab this is 
942 !mailto(thib) 
943
944 # define a variable which is equivalent to " Hello thib and paul! " 
945 # here the newline characters are escaped by a backslash (\) 
946 # and quotes are used to force to keep leading and trailing blanks 
947 TEXT= " Hello\
948  thib and\
949  paul! " 
950
951 # we want to use serial but not bootrun: 
952 !serial(true),b(0) 
953
954 # run after five minutes of execution the first time, 
955 # then run every hour 
956 @first(5) 1h   echo "Run every hour" 
957
958 # run every day 
959 @ 1d echo "fcron daily" 
960
961 # run once between in the morning and once in the afternoon 
962 #  if systems is running at any moment of these time intervals
963 %hours * 8-12,14-18 * * * echo "Hey boss, I'm working today!" 
964
965 # run once a week during our lunch 
966 %weekly * 12-13 echo "I left my system on at least once \
967  at lunch time this week." 
968
969 # run every Sunday and Saturday at 9:05
970 5 9 * * sat,sun echo "Good morning Thibault!" 
971
972 # run every even days of march at 18:00, except on 16th 
973 0 18 2-30/2~16 Mar * echo "It's time to go back home!" 
974
975 # the line above is equivalent to 
976 & 0 18 2-30/2~16 Mar * echo "It's time to go back home!" 
977
978 # reset options to default and set runfreq for lines below 
979 !reset,runfreq(7) 
980
981 # run once every 7 matches (thanks to the declaration above), 
982 # so if system is running every day at 10:00, this will be 
983 # run once a week 
984 & 0 10 * * * echo "if you got this message last time 7 days ago,\
985  this computer has been running every day at 10:00 last week.\
986  If you got the message 8 days ago, then the system has been down \
987  one day at 10:00 since you got it, etc" 
988
989 # wait every hour for a 5 minutes load average under 0.9 
990 @lavg5(0.9) 1h echo "The system load average is low" 
991
992 # wait a maximum of 5 hours every day for a fall of the load average
993 @lavgand,lavg(1,2.0,3.0),until(5h) 1d echo "Load average is going down" 
994
995 # wait for the best moment to run a heavy job 
996 @lavgor,lavg(0.8,1.2,1.5),nice(10) 1w echo "This is a heavy job" 
997
998 # run once every night between either 21:00 and 23:00 or 
999 #   between 3:00 and 6:00 
1000 %nightly,lavg(1.5,2,2) * 21-23,3-6 echo "It's time to retrieve \
1001  the latest release of Mozilla!"
1002 </programlisting>
1003             </example></para>
1004     </refsect1>
1005
1006     <refsect1>
1007         <title>Files</title>
1008         <variablelist>
1009             <varlistentry>
1010                 <term><filename>&etc;/&fcron.conf.location;</filename></term>
1011                 <listitem>
1012                     <para>Configuration file for &fcron;, &fcrontab; and
1013 &fcrondyn;: contains paths (spool dir, pid file) and default programs to use
1014 (editor, shell, etc). See <link linkend="fcron.conf.5">&fcron.conf(5)</link> for
1015 more details.</para>
1016                 </listitem>
1017             </varlistentry>
1018             <varlistentry>
1019                 <term><filename>&etc;/&fcron.allow;</filename></term>
1020                 <listitem>
1021                     <para>Users allowed to use &fcrontab; and &fcrondyn; (one
1022 name per line, special name "all" acts for everyone)</para>
1023                 </listitem>
1024             </varlistentry>
1025             <varlistentry>
1026                 <term><filename>&etc;/&fcron.deny;</filename></term>
1027                 <listitem>
1028                     <para>Users who are not allowed to use &fcrontab; and
1029 &fcrondyn; (same format as allow file)</para>
1030                 </listitem>
1031             </varlistentry>
1032             <varlistentry>
1033                 <term><filename>&etc;/pam.d/fcron</filename> (or
1034 <filename>&etc;/pam.conf</filename>)</term>
1035                 <listitem>
1036                     <para><productname>PAM</productname> configuration file for
1037 &fcron;. Take a look at pam(8) for more details.</para>
1038                 </listitem>
1039             </varlistentry>
1040         </variablelist>
1041     </refsect1>
1042
1043     &manpage-foot;
1044
1045 </refentry>
1046
1047 <!-- Keep this comment at the end of the file
1048 Local variables:
1049 mode: sgml
1050 sgml-parent-document:("fcron-doc.sgml" "book" "chapter" "sect1" "")
1051 End:
1052 -->