1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
<link rel="STYLESHEET" href="../term_tools/main.css" type="text/css">
<title>cron MAN Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body><!-- #BeginLibraryItem "/Library/head_bash.lbi" --><div id="nav-menu">
<ul>
<li><a class="rl" href="../term_tools/index.html"><img src="../term_tools/images/ss64.gif" title="Home" alt="Home"></a></li>
<li><a class="rl" href="../term_tools/bash"><img src="../term_tools/images/bash-l.gif" title="bash" alt="bash"></a></li>
<li><!-- Search Google -->
<form action="http://www.google.com/search" method="get" style="margin:0px;padding:0px;">
<div align="right">
<input name="q" type="text" class="body" size="25">
<input class="submit" type="submit" value="Search">
<input type="hidden" name="q" value="site:ss64.com/bash/">
</div>
</form></li>
<li><a class="rr" href="syntax.html"><img src="../term_tools/images/syntax-r.gif" title="Bash Syntax"></a></li>
</ul>
</div> <!-- #EndLibraryItem --><h1> cron</h1>
<p>daemon to execute scheduled commands</p>
<pre>Syntax
cron</pre>
<p> How to run the cron daemon: Cron should be started from /etc/rc
or /etc/rc.local. It will return immediately, so you don't need to start it
with '&'.<br>
<br>
What cron does<br>
Cron searches<span class="telety"> /var/spool/cron</span> for <a href="crontab.html">crontab</a> files which are named after accounts
in /etc/passwd; crontabs found are loaded into memory. Cron also searches for
/etc/crontab and the files in the /etc/cron.d/ directory, which are in a different
format. </p>
<p>Cron then wakes up every minute, examining all stored <a href="crontab.html">crontabs</a>,
checking each command to see if it should be run in the current minute.<br>
<br>
<strong>Modifying a cron job</strong><br>
To edit a users crontab entry, log into your system for that particular user and type crontab -e.<br>
The default editor for the 'crontab -e' command is vi.<br>
Change the default editor by running: <span class="telety">export VISUAL='<em>editor</em>'</span><br>
<br>
cron checks each minute to see if its spool directory's modtime
(or the modtime on /etc/crontab) has changed, and if it has, cron will then
examine the modtime on all crontabs and reload those which have changed. Thus
cron need not be restarted whenever a crontab file is modfied. Note that
the <a href="crontab.html">crontab</a> command updates the modtime of the
spool directory whenever it changes a crontab. </p>
<p><strong>Mailing output</strong><br>
Cron will email to the <span class="telety">user</span> all output of the commands it runs, to silence this, redirect the output to a log file or to /dev/null<br>
You can also redirect email to the user named in the MAILTO environment variable in the crontab, if such exists. </p>
<p>Cron comes from the word chronos, the Greek word for time.<br>
<br>
<i>"If you do not love your job, change
it. Instead of pushing paper, push ideas. Instead of sitting down, stand
up and be heard. Instead of complaining, contribute. Don't get stuck in a job
description" - <a href="http://www.socresonline.org.uk/1/4/1.html">Microsoft
job advert</a> </i><br>
<br>
<b> Related</b>:<br>
<a href="builtin.html"><br>
</a> <a href="crontab.html">crontab</a> - Schedule a command to run at a later
time<br>
<a href="chroot.html">chroot</a> - Run a command with a different root directory<br>
<a href="exec.html">exec</a> - Execute a command<br>
<a href="if.html">if</a> - Conditionally perform a command<br>
<a href="nohup.html">nohup</a> - Run a command immune to hangups<br>
<a href="su.html">su</a> - Run a command with substitute user and group id<br>
<a href="watch.html">watch</a> - Execute/display a program periodically<br>
<a href="source.html">.period</a> - Run commands from a file <br>
Equivalent Windows commands:
<a href="../term_tools/nt/schtasks.html">schtasks</a> - Schedule a command to run at a later time</p>
<!-- #BeginLibraryItem "/Library/foot_bash.lbi" --><p align="left"><script type="text/javascript"><!--
google_ad_client = "pub-6140977852749469";
google_ad_width = 300;
google_ad_height = 250;
google_ad_format = "300x250_as";
google_ad_type = "text_image";
google_ad_channel ="1984328893";
google_color_border = "CCCCCC";
google_color_bg = "CCCCCC";
google_color_link = "000000";
google_color_text = "333333";
google_color_url = "0000FF";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br>
</p>
<div align="center"><hr size="1">
<p id="top"><a href="#"><img src="../term_tools/images/top-4.gif" width="47" height="53" border="0" alt="Back to the Top" title="Back to the Top"></a></p>
<p class="tagline">© Copyright <a href="http://ss64.com/">SS64.com</a> 1999-2010<br>
Some rights reserved<br>
</p>
</div><!-- #EndLibraryItem --></body>
</html>
|