A copy of the license is included in gfdl.sgml.
-->
-<!-- $Id: faq.sgml,v 1.6 2002-08-11 20:27:54 thib Exp $ -->
+<!-- $Id: faq.sgml,v 1.7 2002-09-07 13:12:16 thib Exp $ -->
<sect1 id="faq">
<title>Frequently Asked Questions</title>
if you still want to receive the standard output as mail, you can add an command
which always evaluates to 0, like "/bin/true", after your primary command. This
will not affect your job nor create additional output. For example:</para>
- <programlisting>* * * * * /a/non/zero/status/job ;
-/bin/true</programlisting>
+ <programlisting>
+* * * * * /a/non/zero/status/job ; /bin/true</programlisting>
</answer>
</qandaentry>
active task count. They are updated each time active task counts are taken.
</para>
<para>
-<!-- It sure would be nice for some MathML here. --> <programlisting> The load
-average formula is: loadavg(d,n) = active_task_cnt - (active_task_cnt -
-old_loadavg)*(1/exp(d/n); where: d is the time interval between active task
-count readings, typically every 5 seconds. n is the time over which the readings
-are averaged. </programlisting>
+<!-- It sure would be nice for some MathML here. -->
+The load average formula is: <programlisting>
+loadavg(d,n) = active_task_cnt - (active_task_cnt - old_loadavg)*(1/exp(d/n)
+</programlisting>
+where: d is the time interval between active task count readings, typically every
+5 seconds; n is the time over which the readings are averaged.
</para>
</answer>
</qandaentry>
You can use pipes with "<command>fcrontab -l</command>" (list the
fcrontab) and "<command>fcrontab -</command>" (read the new fcrontab from
input). For example : </para>
- <screen><command>echo -e "`fcrontab -l | grep -v exim`\n0 * * *
-* /usr/sbin/exim -q" | fcrontab -</command></screen>
+ <screen> <command>echo -e "`fcrontab -l | grep -v exim`\n0 * * * * /usr/sbin/exim -q" | fcrontab -</command></screen>
<para>
can be used to add a line. Another way to do it would be to:
list the fcrontab settings into a temporary file ("<command>fcrontab -l >
every day, week, etc, at dialup connection</title>
<para>You can use a script like :</para>
<programlisting>
-# A ppp-up script ... # run the jobs pending, then returns : fcron -f -y -o
+# A ppp-up script ...
+# run the jobs pending, then returns :
+fcron -f -y -o
</programlisting>
<para>in conjunction with a fcrontab file like :</para>
<programlisting>
-# a fcrontab file ... %random(no),weekly,stdout * *
-/a/command/to/download/latest/mozilla/release %monthly,stdout * * *
-/update/junkbuster/config/files
+# a fcrontab file ...
+%random(no),weekly,stdout * * /a/command/to/download/latest/mozilla/release
+%monthly,stdout * * * /update/junkbuster/config/files
</programlisting>
</example></para>
<para>You can also use fcron to run some jobs until the end of
end of the connection</title>
<para>ppp-up script :</para>
<programlisting>
-# A ppp-up script ... # run fcron at the beginning of the connection : fcron -b
+# A ppp-up script ...
+# run fcron at the beginning of the connection :
+fcron -b
</programlisting>
<para>ppp-down script :</para>
<programlisting>
-# A ppp-down script ... # stop fcron at the end of the connection : # -- Warning
-: killall may have unwanted effect on non linux systems -- killall -TERM fcron
+# A ppp-down script ...
+# stop fcron at the end of the connection :
+# -- Warning : killall may have unwanted effect on non linux systems --
+killall -TERM fcron
</programlisting>
<para>the fcrontab :</para>
<programlisting>
-# a fcrontab file ... @volatile,first(0) 5 fetchmail
+# a fcrontab file ...
+@volatile,first(0) 5 fetchmail
</programlisting>
</example></para>
A copy of the license is included in gfdl.sgml.
-->
-<!-- $Id: fcrontab.5.sgml,v 1.9 2002-08-29 17:35:32 thib Exp $ -->
+<!-- $Id: fcrontab.5.sgml,v 1.10 2002-09-07 13:12:33 thib Exp $ -->
<refentry id="fcrontab.5">
<refmeta>
<title>Some examples of lines based on elapsed system up
time</title>
<programlisting>
-# Get our mails every 30 minutes @ 30 getmails -all # make some security tests
-every 48 hours of system up time, # force a mail to be sent to root even if
-there is no output @mailto(root),forcemail 2d
-/etc/security/msec/cron-sh/security.sh
+# Get our mails every 30 minutes
+@ 30 getmails -all
+
+# make some security tests every 48 hours of system up time,
+# force a mail to be sent to root even if there is no output
+@mailto(root),forcemail 2d /etc/security/msec/cron-sh/security.sh
</programlisting>
</example></para>
</refsect2>
frequency of execution (this is equivalent to option &optrunfreq;) or a
declaration of options; it has five time and date fields, and a shell command
:</para>
- <programlisting>&options min hrs day-of-month month day-of-week
-command</programlisting>
+ <programlisting>
+&options min hrs day-of-month month day-of-week command
+</programlisting>
<para>Note that the shell command may be preceded by a user name,
which is equivalent to <token>runas(<replaceable>user</replaceable>)</token>: as
it is only here for backward compatibility you should use option &optrunas; (see
&optmail;, &optnolog;, &optserial;, &optlavg;, &optnice;, &optrunas; (see
below).</para>
<para><example>
- <title>Some examples of entries based on time and
-date</title>
+ <title>Some examples of entries based on time and date</title>
<programlisting>
-# run mycommand at 12:05, 12:35, 13:05, 13:35, 14:05 *and* 14:35 everyday &
-05,35 12-14 * * * mycommand -u me -o file # get mails every hours past 20, 21,
-22, and 24 minutes. 20-24~23 * * * * getmail # save our work of the day every
-night at 03:45 with a low priority # unless we are sunday, mail the output to
-jim and run that job # at startup if computer was down at 03:45
+# run mycommand at 12:05, 12:35, 13:05, 13:35,
+# 14:05 *and* 14:35 everyday
+&05,35 12-14 * * * mycommand -u me -o file
+
+# get mails every hours past 20, 21, 22, and 24 minutes.
+20-24~23 * * * * getmail
+
+# save our work of the day every night at 03:45 with a low priority
+# unless we are sunday, mail the output to jim and run that job
+# at startup if computer was down at 03:45
&nice(10),mailto(jim),bootrun 45 03 * * *~0 "save --our work"
</programlisting>
</example></para>
<para><example>
<title>An example of a user fcrontab</title>
<programlisting>
-# use /bin/bash to run commands, ignoring what /etc/passwd says SHELL=/bin/bash
-# mail output to thib, no matter whose fcrontab this is !mailto(thib) # define a
-variable which is equivalent to " Hello thib and paul ! " # here the newline
-characters are escaped by a backslash (\) # and quotes are used to force to keep
-leading and trailing blanks TEXT= " Hello\ thib and\ paul ! " # we want to use
-serial but not bootrun: !serial(true),b(0) # run after five minutes of execution
-the first time, # then run every hours @first(5) 1h echo "Run every hours" #
-run every days @ 1d echo "fcron daily" # run once between in the morning and
-once in the afternoon # if systems is running at any moment of these intervals
-%hours * 8-12,14-18 * * * echo "Hey boss, I'm working today !" # run once a week
-during our lunch %weekly * 12-13 echo "I left my system on at least once \ at
-lunch time this week." # run every Sunday and Saturday at 9:05 5 9 * * sat,sun
-echo "Good morning Thibault !" # run every peer days of march at 18:00, except
-on 16th 0 18 2-30/2~16 Mar * echo "It's time to go back home !" # the line above
-is equivalent to & 0 18 2-30/2~16 Mar * echo "It's time to go back home !" #
-reset options to default and set runfreq for lines below !reset,runfreq(7) # run
-once every 7 matches (thanks to the declaration above), # so if system is
-running every day at 10:00, this will be # run once a week & 0 10 * * * echo "if
-you got this message last time 7 days ago,\ this computer has been running every
-day at 10:00 last week.\ If you got the message 8 days ago, then the system has
-been down \ one day at 10:00 since you got it, etc" # wait every hour for a 5
-minutes load average under 0.9 @lavg5(0.9) 1h echo "The system load average is
-low" # wait a maximum of 5 hours every day for a fall of the load average
-@lavgand,lavg(1,2.0,3.0),until(5h) 1d echo "Load average is going down" # wait
-for the best moment to run a heavy job @lavgor,lavg(0.8,1.2,1.5),nice(10) 1w
-echo "This is a heavy job" # run once every night between either 21:00 and 23:00
-or # between 3:00 and 6:00 %nightly,lavg(1.5,2,2) * 21-23,3-6 echo "It's time
-to retrieve \ the last release of Mozilla !"</programlisting>
+# use /bin/bash to run commands, ignoring what /etc/passwd says
+SHELL=/bin/bash
+
+# mail output to thib, no matter whose fcrontab this is
+!mailto(thib)
+
+# define a variable which is equivalent to " Hello thib and paul ! "
+# here the newline characters are escaped by a backslash (\)
+# and quotes are used to force to keep leading and trailing blanks
+TEXT= " Hello\
+ thib and\
+ paul ! "
+
+# we want to use serial but not bootrun:
+!serial(true),b(0)
+
+# run after five minutes of execution the first time,
+# then run every hours
+@first(5) 1h echo "Run every hours"
+
+# run every days
+@ 1d echo "fcron daily"
+
+# run once between in the morning and once in the afternoon
+# if systems is running at any moment of these intervals
+%hours * 8-12,14-18 * * * echo "Hey boss, I'm working today !"
+
+# run once a week during our lunch
+%weekly * 12-13 echo "I left my system on at least once \
+ at lunch time this week."
+
+# run every Sunday and Saturday at 9:05
+5 9 * * sat,sun echo "Good morning Thibault !"
+
+# run every peer days of march at 18:00, except on 16th
+0 18 2-30/2~16 Mar * echo "It's time to go back home !"
+
+# the line above is equivalent to
+& 0 18 2-30/2~16 Mar * echo "It's time to go back home !"
+
+# reset options to default and set runfreq for lines below
+!reset,runfreq(7)
+
+# run once every 7 matches (thanks to the declaration above),
+# so if system is running every day at 10:00, this will be
+# run once a week
+& 0 10 * * * echo "if you got this message last time 7 days ago,\
+ this computer has been running every day at 10:00 last week.\
+ If you got the message 8 days ago, then the system has been down \
+ one day at 10:00 since you got it, etc"
+
+# wait every hour for a 5 minutes load average under 0.9
+@lavg5(0.9) 1h echo "The system load average is low"
+
+# wait a maximum of 5 hours every day for a fall of the load average
+@lavgand,lavg(1,2.0,3.0),until(5h) 1d echo "Load average is going down"
+
+# wait for the best moment to run a heavy job
+@lavgor,lavg(0.8,1.2,1.5),nice(10) 1w echo "This is a heavy job"
+
+# run once every night between either 21:00 and 23:00 or
+# between 3:00 and 6:00
+%nightly,lavg(1.5,2,2) * 21-23,3-6 echo "It's time to retrieve \
+ the latest release of Mozilla !"
+</programlisting>
</example></para>
</refsect1>