1 |
neysx 06/01/04 11:22:18 |
2 |
|
3 |
Modified: xml/htdocs/doc/en cron-guide.xml |
4 |
Log: |
5 |
#117683 explain cronbase |
6 |
|
7 |
Revision Changes Path |
8 |
1.7 +99 -39 xml/htdocs/doc/en/cron-guide.xml |
9 |
|
10 |
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 |
11 |
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 |
12 |
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 |
13 |
|
14 |
Index: cron-guide.xml |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/cron-guide.xml,v |
17 |
retrieving revision 1.6 |
18 |
retrieving revision 1.7 |
19 |
diff -u -r1.6 -r1.7 |
20 |
--- cron-guide.xml 1 Jan 2006 11:51:43 -0000 1.6 |
21 |
+++ cron-guide.xml 4 Jan 2006 11:22:18 -0000 1.7 |
22 |
@@ -1,5 +1,5 @@ |
23 |
<?xml version='1.0' encoding="UTF-8"?> |
24 |
-<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/cron-guide.xml,v 1.6 2006/01/01 11:51:43 neysx Exp $ --> |
25 |
+<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/cron-guide.xml,v 1.7 2006/01/04 11:22:18 neysx Exp $ --> |
26 |
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
27 |
|
28 |
<guide link="/doc/en/cron-guide.xml"> |
29 |
@@ -20,8 +20,8 @@ |
30 |
<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
31 |
<license/> |
32 |
|
33 |
-<version>1.4</version> |
34 |
-<date>2005-07-25</date> |
35 |
+<version>1.5</version> |
36 |
+<date>2005-01-04</date> |
37 |
|
38 |
<chapter> |
39 |
<title>Cron basics</title> |
40 |
@@ -51,7 +51,14 @@ |
41 |
Portage. All of them offer a similar interface, namely the use of |
42 |
<c>crontab</c> or a similar command. There is also a related utility called |
43 |
Anacron which is meant to work with cron on systems that are not continuously |
44 |
-running. |
45 |
+running. |
46 |
+</p> |
47 |
+ |
48 |
+<p> |
49 |
+It is also worth noting that all three of the available cron packages depend on |
50 |
+<c>sys-process/cronbase</c>. This package is not technically depended on by any |
51 |
+of the cron packages, but it does provide cron-like functionality that most |
52 |
+users can appreciate. |
53 |
</p> |
54 |
|
55 |
<p> |
56 |
@@ -115,13 +122,13 @@ |
57 |
</p> |
58 |
|
59 |
<ul> |
60 |
-<li> |
61 |
- Fast, simple and free of unnecessary features |
62 |
-</li> |
63 |
-<li> |
64 |
- Access to <c>crontab</c> is limited to the cron group, i.e. it doesn't rely on |
65 |
- any external faculties |
66 |
-</li> |
67 |
+ <li> |
68 |
+ Fast, simple and free of unnecessary features |
69 |
+ </li> |
70 |
+ <li> |
71 |
+ Access to <c>crontab</c> is limited to the cron group, i.e. it doesn't rely on |
72 |
+ any external faculties |
73 |
+ </li> |
74 |
</ul> |
75 |
|
76 |
</body> |
77 |
@@ -144,29 +151,25 @@ |
78 |
</p> |
79 |
|
80 |
<ul> |
81 |
-<li> |
82 |
- Designed to work on systems that are not continuously running, i.e. it can run |
83 |
- a job after restarting if it was missed |
84 |
-</li> |
85 |
-<li> |
86 |
- Setting of environment variables and many other options in crontabs |
87 |
-</li> |
88 |
-<li> |
89 |
- Each user can have his own crontab, access is controlled by cron.allow and |
90 |
- cron.deny |
91 |
-</li> |
92 |
-<li> |
93 |
- Enhanced crontab syntax with support for many new features |
94 |
-</li> |
95 |
+ <li> |
96 |
+ Designed to work on systems that are not continuously running, i.e. it can |
97 |
+ run a job after restarting if it was missed |
98 |
+ </li> |
99 |
+ <li>Setting of environment variables and many other options in crontabs</li> |
100 |
+ <li> |
101 |
+ Each user can have his own crontab, access is controlled by cron.allow and |
102 |
+ cron.deny |
103 |
+ </li> |
104 |
+ <li>Enhanced crontab syntax with support for many new features</li> |
105 |
</ul> |
106 |
|
107 |
- |
108 |
</body> |
109 |
</section> |
110 |
|
111 |
<section> |
112 |
<title>Anacron</title> |
113 |
<body> |
114 |
+ |
115 |
<p> |
116 |
Anacron is not a cron daemon, it is something that usually works in |
117 |
conjunction with one. It executes commands at intervals specified in days and |
118 |
@@ -174,8 +177,8 @@ |
119 |
that were missed while the system was down. Anacron usually relies on a cron |
120 |
daemon to run it each day. |
121 |
</p> |
122 |
-</body> |
123 |
|
124 |
+</body> |
125 |
</section> |
126 |
</chapter> |
127 |
|
128 |
@@ -208,22 +211,23 @@ |
129 |
|
130 |
</body> |
131 |
</section> |
132 |
-<section> |
133 |
+<section id="systemtab"> |
134 |
<title>System crontab</title> |
135 |
<body> |
136 |
|
137 |
<p> |
138 |
The post install messages from some of these cron packages tell you to run |
139 |
<c>crontab /etc/crontab</c>. The <path>/etc/crontab</path> file is your |
140 |
-<e>system crontab</e>. A default Gentoo installation uses it to run the |
141 |
-scripts in <path>/etc/cron.{daily,hourly,weekly,monthly}</path>. Note that |
142 |
+<e>system crontab</e>. A cron installation can use it in conjunction with |
143 |
+<c>sys-process/cronbase</c> to run the scripts in |
144 |
+<path>/etc/cron.{daily,hourly,weekly,monthly}</path>. Note that only |
145 |
Vixie-cron schedules jobs in <path>/etc/crontab</path> automatically. Dcron and |
146 |
Fcron users will need to run <c>crontab /etc/crontab</c> every time they make |
147 |
changes to <path>/etc/crontab</path>. |
148 |
</p> |
149 |
|
150 |
<p> |
151 |
-Please note that jobs scheduled in the system crontab will not show up in the |
152 |
+Please note that jobs scheduled in the system crontab might not show up in the |
153 |
list of cron-jobs displayed by <c>crontab -l</c>. |
154 |
</p> |
155 |
|
156 |
@@ -339,36 +343,41 @@ |
157 |
<table> |
158 |
<tr> |
159 |
<th>Version</th> |
160 |
- <th>Edit command</th> |
161 |
- <th>Remove command</th> |
162 |
- <th>New command</th> |
163 |
- <th>List command</th> |
164 |
+ <th>Edit crontab</th> |
165 |
+ <th>Remove crontab</th> |
166 |
+ <th>New crontab</th> |
167 |
+ <th>List cron-jobs</th> |
168 |
</tr> |
169 |
<tr> |
170 |
<ti>dcron</ti> |
171 |
<ti><c>crontab -e</c></ti> |
172 |
- <ti><c>crontab -d</c></ti> |
173 |
+ <ti><c>crontab -d <e>[user]</e></c></ti> |
174 |
<ti><c>crontab <e>file</e></c></ti> |
175 |
<ti><c>crontab -l</c></ti> |
176 |
</tr> |
177 |
<tr> |
178 |
<ti>fcron</ti> |
179 |
<ti><c>fcrontab -e</c></ti> |
180 |
- <ti><c>fcrontab -r</c></ti> |
181 |
+ <ti><c>fcrontab -r <e>[user]</e></c></ti> |
182 |
<ti><c>fcrontab <e>file</e></c></ti> |
183 |
<ti><c>fcrontab -l</c></ti> |
184 |
</tr> |
185 |
<tr> |
186 |
<ti>vixie-cron</ti> |
187 |
<ti><c>crontab -e</c></ti> |
188 |
- <ti><c>crontab -r</c></ti> |
189 |
+ <ti><c>crontab -r <e>[user]</e></c></ti> |
190 |
<ti><c>crontab <e>file</e></c></ti> |
191 |
<ti><c>crontab -l</c></ti> |
192 |
</tr> |
193 |
</table> |
194 |
|
195 |
<note> |
196 |
-Fcron also makes a symlink to <c>crontab</c>. |
197 |
+When using the remove command, if no argument is supplied, it deletes the |
198 |
+current user's crontab. |
199 |
+</note> |
200 |
+ |
201 |
+<note> |
202 |
+Fcron also has a symlink from <c>crontab</c> to <c>fcrontab</c>. |
203 |
</note> |
204 |
|
205 |
<p> |
206 |
@@ -567,6 +576,57 @@ |
207 |
</chapter> |
208 |
|
209 |
<chapter> |
210 |
+<title>Using cronbase</title> |
211 |
+<section> |
212 |
+<body> |
213 |
+ |
214 |
+<p> |
215 |
+As mentioned earlier, all three of the available cron packages depend on |
216 |
+<c>sys-process/cronbase</c>. The cronbase package creates |
217 |
+<path>/etc/cron.{hourly,daily,weekly,monthly}</path>, and a script called |
218 |
+<c>run-crons</c>. You might have noticed that the default |
219 |
+<path>/etc/crontab</path> contains something like this: |
220 |
+</p> |
221 |
+ |
222 |
+<pre caption="Default system crontab"> |
223 |
+*/15 * * * * test -x /usr/sbin/run-crons && /usr/sbin/run-crons |
224 |
+0 * * * * rm -f /var/spool/cron/lastrun/cron.hourly |
225 |
+0 3 * * * rm -f /var/spool/cron/lastrun/cron.daily |
226 |
+15 4 * * 6 rm -f /var/spool/cron/lastrun/cron.weekly |
227 |
+30 5 1 * * rm -f /var/spool/cron/lastrun/cron.monthly |
228 |
+</pre> |
229 |
+ |
230 |
+<p> |
231 |
+To avoid going into much detail, we can just assume that these commands will |
232 |
+effectively run your hourly, daily, weekly and monthly scripts. This method of |
233 |
+scheduling cron-jobs has some important advantages: |
234 |
+</p> |
235 |
+ |
236 |
+<ul> |
237 |
+ <li> |
238 |
+ They will run even if your computer was off when they were scheduled to run |
239 |
+ </li> |
240 |
+ <li> |
241 |
+ It is easy for package maintainers to place scripts in those well defined |
242 |
+ places |
243 |
+ </li> |
244 |
+ <li> |
245 |
+ You know exactly where your cron-jobs and your crontab are stored, making |
246 |
+ it easy for you to backup and restore this part of your system |
247 |
+ </li> |
248 |
+</ul> |
249 |
+ |
250 |
+<note> |
251 |
+Again, it is useful to point out that Vixie cron automatically reads |
252 |
+<path>/etc/crontab</path>, while dcron and fcron do not. Please read the <uri |
253 |
+link="#systemtab">System crontab</uri> section to read more about this. |
254 |
+</note> |
255 |
+ |
256 |
+</body> |
257 |
+</section> |
258 |
+</chapter> |
259 |
+ |
260 |
+<chapter> |
261 |
<title>Final Notes</title> |
262 |
<section> |
263 |
<title>Troubleshooting</title> |
264 |
|
265 |
|
266 |
|
267 |
-- |
268 |
gentoo-doc-cvs@g.o mailing list |