https://www.slackwiki.com/index.php?title=Cron_Jobs&feed=atom&action=historyCron Jobs - Revision history2024-03-28T13:18:22ZRevision history for this page on the wikiMediaWiki 1.40.0https://www.slackwiki.com/index.php?title=Cron_Jobs&diff=98&oldid=prevErik at 03:38, 2 June 20092009-06-02T03:38:57Z<p></p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 03:38, 2 June 2009</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">Based on [[User:Sandman1|Sandman1]]'s tutorial.</del></div></td><td colspan="2" class="diff-side-added"></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"></del></div></td><td colspan="2" class="diff-side-added"></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Well you are reading this tutorial because you need to schedule a certain task or a script on a certain day. First you need to know a few things about cron before we get started. One of those things is the table below:</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Well you are reading this tutorial because you need to schedule a certain task or a script on a certain day. First you need to know a few things about cron before we get started. One of those things is the table below:</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
</table>Erikhttps://www.slackwiki.com/index.php?title=Cron_Jobs&diff=97&oldid=prevErik: Copy from old2009-06-02T03:38:28Z<p>Copy from old</p>
<p><b>New page</b></p><div>Based on [[User:Sandman1|Sandman1]]'s tutorial.<br />
<br />
Well you are reading this tutorial because you need to schedule a certain task or a script on a certain day. First you need to know a few things about cron before we get started. One of those things is the table below:<br />
<br />
1 = minute past the hour (0 through 59)<br />
2 = hour (0 through 23)<br />
3 = day of month (1 through 31)<br />
4 = month of year (1 through 12)<br />
5 = day of the week<br />
0 = Sunday (This can also be 7)<br />
1 = Monday<br />
2 = Tuesday<br />
3 = Wednesday<br />
4 = Thursday<br />
5 = Friday<br />
6 = Saturday<br />
<br />
This table will be used later on in this tutorial. Now first part of editing a cron entry is typing in the following command:<br />
<br />
: <code>crontab -e</code><br />
<br />
(I usually do this as root if the command needed to run requires root)<br />
<br />
Well this brings up the regular vi(elvis in slackware) screen. Most people don't use VI. There is a variable you can set to change the default cron editor.<br />
<br />
: <code>export VISUAL=pico</code><br />
<br />
That will change the default editor for the session to pico. It's a little friendlier when it comes to editing for some people out there. There is also a GNU editor like pico called nano. Now we need to schedule a command for running.<br />
<br />
: <code>6 10 * * * /root/scripts/example</code><br />
<br />
The example above here will run the command /root/scripts/example at 10:06 every day. The numbers above (on the table) symbolize the mark of where it belongs. So the 6 would be number 1 on the table and the 10 will be the hour.<br />
<br />
: <code>*/30 * * * * /root/scripts/example</code><br />
<br />
The entry above will run the /root/scripts/example every 30 minutes of every day. Now save your entries and they will run when you tell them to. You also want to add 1> /dev/null on the end of your command so you send the output to /dev/null instead of roots email (this is default on slackware). Good luck!<br />
<br />
[[Category:Tutorials]]</div>Erik