neysx 06/01/04 11:22:18 Modified: xml/htdocs/doc/en cron-guide.xml Log: #117683 explain cronbase
Revision Changes Path 1.7 +99 -39 xml/htdocs/doc/en/cron-guide.xml file : http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/cron-guide.xml?rev=1.7&content-type=text/x-cvsweb-markup&cvsroot=gentoo plain: http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/cron-guide.xml?rev=1.7&content-type=text/plain&cvsroot=gentoo diff : http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/cron-guide.xml.diff?r1=1.6&r2=1.7&cvsroot=gentoo Index: cron-guide.xml =================================================================== RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/cron-guide.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- cron-guide.xml 1 Jan 2006 11:51:43 -0000 1.6 +++ cron-guide.xml 4 Jan 2006 11:22:18 -0000 1.7 @@ -1,5 +1,5 @@ <?xml version='1.0' encoding="UTF-8"?> -<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/cron-guide.xml,v 1.6 2006/01/01 11:51:43 neysx Exp $ --> +<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/cron-guide.xml,v 1.7 2006/01/04 11:22:18 neysx Exp $ --> <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> <guide link="/doc/en/cron-guide.xml"> @@ -20,8 +20,8 @@ <!-- See http://creativecommons.org/licenses/by-sa/2.5 --> <license/> -<version>1.4</version> -<date>2005-07-25</date> +<version>1.5</version> +<date>2005-01-04</date> <chapter> <title>Cron basics</title> @@ -51,7 +51,14 @@ Portage. All of them offer a similar interface, namely the use of <c>crontab</c> or a similar command. There is also a related utility called Anacron which is meant to work with cron on systems that are not continuously -running. +running. +</p> + +<p> +It is also worth noting that all three of the available cron packages depend on +<c>sys-process/cronbase</c>. This package is not technically depended on by any +of the cron packages, but it does provide cron-like functionality that most +users can appreciate. </p> <p> @@ -115,13 +122,13 @@ </p> <ul> -<li> - Fast, simple and free of unnecessary features -</li> -<li> - Access to <c>crontab</c> is limited to the cron group, i.e. it doesn't rely on - any external faculties -</li> + <li> + Fast, simple and free of unnecessary features + </li> + <li> + Access to <c>crontab</c> is limited to the cron group, i.e. it doesn't rely on + any external faculties + </li> </ul> </body> @@ -144,29 +151,25 @@ </p> <ul> -<li> - Designed to work on systems that are not continuously running, i.e. it can run - a job after restarting if it was missed -</li> -<li> - Setting of environment variables and many other options in crontabs -</li> -<li> - Each user can have his own crontab, access is controlled by cron.allow and - cron.deny -</li> -<li> - Enhanced crontab syntax with support for many new features -</li> + <li> + Designed to work on systems that are not continuously running, i.e. it can + run a job after restarting if it was missed + </li> + <li>Setting of environment variables and many other options in crontabs</li> + <li> + Each user can have his own crontab, access is controlled by cron.allow and + cron.deny + </li> + <li>Enhanced crontab syntax with support for many new features</li> </ul> - </body> </section> <section> <title>Anacron</title> <body> + <p> Anacron is not a cron daemon, it is something that usually works in conjunction with one. It executes commands at intervals specified in days and @@ -174,8 +177,8 @@ that were missed while the system was down. Anacron usually relies on a cron daemon to run it each day. </p> -</body> +</body> </section> </chapter> @@ -208,22 +211,23 @@ </body> </section> -<section> +<section id="systemtab"> <title>System crontab</title> <body> <p> The post install messages from some of these cron packages tell you to run <c>crontab /etc/crontab</c>. The <path>/etc/crontab</path> file is your -<e>system crontab</e>. A default Gentoo installation uses it to run the -scripts in <path>/etc/cron.{daily,hourly,weekly,monthly}</path>. Note that +<e>system crontab</e>. A cron installation can use it in conjunction with +<c>sys-process/cronbase</c> to run the scripts in +<path>/etc/cron.{daily,hourly,weekly,monthly}</path>. Note that only Vixie-cron schedules jobs in <path>/etc/crontab</path> automatically. Dcron and Fcron users will need to run <c>crontab /etc/crontab</c> every time they make changes to <path>/etc/crontab</path>. </p> <p> -Please note that jobs scheduled in the system crontab will not show up in the +Please note that jobs scheduled in the system crontab might not show up in the list of cron-jobs displayed by <c>crontab -l</c>. </p> @@ -339,36 +343,41 @@ <table> <tr> <th>Version</th> - <th>Edit command</th> - <th>Remove command</th> - <th>New command</th> - <th>List command</th> + <th>Edit crontab</th> + <th>Remove crontab</th> + <th>New crontab</th> + <th>List cron-jobs</th> </tr> <tr> <ti>dcron</ti> <ti><c>crontab -e</c></ti> - <ti><c>crontab -d</c></ti> + <ti><c>crontab -d <e>[user]</e></c></ti> <ti><c>crontab <e>file</e></c></ti> <ti><c>crontab -l</c></ti> </tr> <tr> <ti>fcron</ti> <ti><c>fcrontab -e</c></ti> - <ti><c>fcrontab -r</c></ti> + <ti><c>fcrontab -r <e>[user]</e></c></ti> <ti><c>fcrontab <e>file</e></c></ti> <ti><c>fcrontab -l</c></ti> </tr> <tr> <ti>vixie-cron</ti> <ti><c>crontab -e</c></ti> - <ti><c>crontab -r</c></ti> + <ti><c>crontab -r <e>[user]</e></c></ti> <ti><c>crontab <e>file</e></c></ti> <ti><c>crontab -l</c></ti> </tr> </table> <note> -Fcron also makes a symlink to <c>crontab</c>. +When using the remove command, if no argument is supplied, it deletes the +current user's crontab. +</note> + +<note> +Fcron also has a symlink from <c>crontab</c> to <c>fcrontab</c>. </note> <p> @@ -567,6 +576,57 @@ </chapter> <chapter> +<title>Using cronbase</title> +<section> +<body> + +<p> +As mentioned earlier, all three of the available cron packages depend on +<c>sys-process/cronbase</c>. The cronbase package creates +<path>/etc/cron.{hourly,daily,weekly,monthly}</path>, and a script called +<c>run-crons</c>. You might have noticed that the default +<path>/etc/crontab</path> contains something like this: +</p> + +<pre caption="Default system crontab"> +*/15 * * * * test -x /usr/sbin/run-crons && /usr/sbin/run-crons +0 * * * * rm -f /var/spool/cron/lastrun/cron.hourly +0 3 * * * rm -f /var/spool/cron/lastrun/cron.daily +15 4 * * 6 rm -f /var/spool/cron/lastrun/cron.weekly +30 5 1 * * rm -f /var/spool/cron/lastrun/cron.monthly +</pre> + +<p> +To avoid going into much detail, we can just assume that these commands will +effectively run your hourly, daily, weekly and monthly scripts. This method of +scheduling cron-jobs has some important advantages: +</p> + +<ul> + <li> + They will run even if your computer was off when they were scheduled to run + </li> + <li> + It is easy for package maintainers to place scripts in those well defined + places + </li> + <li> + You know exactly where your cron-jobs and your crontab are stored, making + it easy for you to backup and restore this part of your system + </li> +</ul> + +<note> +Again, it is useful to point out that Vixie cron automatically reads +<path>/etc/crontab</path>, while dcron and fcron do not. Please read the <uri +link="#systemtab">System crontab</uri> section to read more about this. +</note> + +</body> +</section> +</chapter> + +<chapter> <title>Final Notes</title> <section> <title>Troubleshooting</title> -- [email protected] mailing list
