<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.docking.org/index.php?action=history&amp;feed=atom&amp;title=Cron</id>
	<title>Cron - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.docking.org/index.php?action=history&amp;feed=atom&amp;title=Cron"/>
	<link rel="alternate" type="text/html" href="http://wiki.docking.org/index.php?title=Cron&amp;action=history"/>
	<updated>2026-04-07T06:04:09Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.1</generator>
	<entry>
		<id>http://wiki.docking.org/index.php?title=Cron&amp;diff=9459&amp;oldid=prev</id>
		<title>Benrwong: Created page based on &quot;ALL ABOUT CRON&quot; from lab manual</title>
		<link rel="alternate" type="text/html" href="http://wiki.docking.org/index.php?title=Cron&amp;diff=9459&amp;oldid=prev"/>
		<updated>2016-06-30T17:55:14Z</updated>

		<summary type="html">&lt;p&gt;Created page based on &amp;quot;ALL ABOUT CRON&amp;quot; from lab manual&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt; vim /etc/crontab&lt;br /&gt;
In this file you should see this:&lt;br /&gt;
 SHELL=/bin/bash&lt;br /&gt;
 PATH=/sbin:/bin:/usr/sbin:/usr/bin&lt;br /&gt;
 MAILTO=root&lt;br /&gt;
 HOME=/ &amp;lt;br /&amp;gt;&lt;br /&gt;
 # For details see man 4 crontabs &amp;lt;br /&amp;gt;&lt;br /&gt;
 # Example of job definition:&lt;br /&gt;
 # .---------------- minute (0 - 59)&lt;br /&gt;
 # |  .------------- hour (0 - 23)&lt;br /&gt;
 # |  |  .---------- day of month (1 - 31)&lt;br /&gt;
 # |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...&lt;br /&gt;
 # |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat&lt;br /&gt;
 # |  |  |  |  |&lt;br /&gt;
 # *  *  *  *  * user-name command to be executed&lt;br /&gt;
&lt;br /&gt;
In /etc, there are five directories associated with cron:&lt;br /&gt;
cron.d, cron.daily, cron.hourly, cron.monthly and cron.weekly&lt;br /&gt;
&lt;br /&gt;
To enable the scripts in these directories to be run you need to add them to the crontab, so, /etc/crontab should look like this:&lt;br /&gt;
&lt;br /&gt;
 SHELL=/bin/bash&lt;br /&gt;
 PATH=/sbin:/bin:/usr/sbin:/usr/bin&lt;br /&gt;
 MAILTO=root&lt;br /&gt;
 HOME=/ &amp;lt;br /&amp;gt;&lt;br /&gt;
 # For details see man 4 crontabs &amp;lt;br /&amp;gt;&lt;br /&gt;
 # Example of job definition:&lt;br /&gt;
 # .---------------- minute (0 - 59)&lt;br /&gt;
 # |  .------------- hour (0 - 23)&lt;br /&gt;
 # |  |  .---------- day of month (1 - 31)&lt;br /&gt;
 # |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...&lt;br /&gt;
 # |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat&lt;br /&gt;
 # |  |  |  |  |&lt;br /&gt;
 # *  *  *  *  * user-name command to be executed&lt;br /&gt;
 01 * * * * root run-parts /etc/cron.hourly&lt;br /&gt;
 02 4 * * * root run-parts /etc/cron.daily&lt;br /&gt;
 22 4 * * 0 root run-parts /etc/cron.weekly&lt;br /&gt;
 42 4 1 * * root run-parts /etc/cron.monthly &amp;lt;br /&amp;gt;&lt;br /&gt;
 What this means is that:&lt;br /&gt;
 cron.hourly will run every hour on the first minute.&lt;br /&gt;
 cron.daily will run at 4:02 am everyday&lt;br /&gt;
 cron.weekly will run every week at 4:22 am on Sunday&lt;br /&gt;
 cron.monthly will run on the first of every month at 4:42 am &lt;br /&gt;
I added a script to clean out the /tmp directory every night like this: &lt;br /&gt;
In /etc/cron.daily/ I created a file called clean_tmp.  I added the lines:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash &amp;lt;br /&amp;gt;&lt;br /&gt;
 rm -rf /tmp/*&lt;br /&gt;
&lt;br /&gt;
Saved and quit.  Then I typed chmod a+x clean_tmp&lt;br /&gt;
That’s it!&lt;br /&gt;
&lt;br /&gt;
[[Category:Sysadmin]]&lt;/div&gt;</summary>
		<author><name>Benrwong</name></author>
	</entry>
</feed>