-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrontab.html
69 lines (69 loc) · 3.35 KB
/
crontab.html
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
<!DOCTYPE html>
<html>
<head>
<title>Crontab Reference Sheet</title>
<link rel="stylesheet" href="style.css" type="text/css"/>
</head>
<body>
<div id="container">
<div id="main">
<h1>Using PuTTy to edit cron job/crontab (like VI)</h1>
<p>For editing cron jobs on a server. Steps to edit and explanation of what each thing means.</p>
<h2>Steps in PuTTY to access and edit</h2>
<p><strong>Step 1.</strong> Login to the server.</p>
<p><strong>Step 2.</strong> Type <code>crontab -e</code> to open crontab. Scroll down (may need to use arrow keys) to view current commands list.</p>
<p><strong>Step 3.</strong> Press <strong>Insert</strong> to make cron jobs editable.</p>
<p><strong>Step 4.</strong> Edit file, then press <strong>Esc</strong> to stop editing.</p>
<p><strong>Step 5.</strong> Type <code>:wq</code> to exit the crontab. You'll need to do this to get the message <code>"installing new crontab"</code></p>
<h2>Basic Cron Setup</h2>
<p>Cron allows a great deal of specificity in how things are set up:</p>
<pre>MIN — Minute 0-60<br/>HOUR — Hour [24-hour clock] 0-23<br/>MDAY — Day of Month 1-31<br/>MON — Month 1-12 OR jan,feb,mar,apr&ellip;<br/>DOW — Day Of Week 0-6 OR sun,mon,tue,wed,thu,fri,sat<br/>COMMAND — Command to be run Any valid command-line<br/>
</pre>
<table>
<tr>
<td width="5%">MIN</td>
<td width="5%">HOUR</td>
<td width="5%">MDAY</td>
<td width="5%">MON</td>
<td width="5%">DOW</td>
<td>COMMAND</td>
</tr>
<tr>
<td width="5%">*/10</td>
<td width="5%">*</td>
<td width="5%">*</td>
<td width="5%">*</td>
<td width="5%">*</td>
<td>wget http://mydomain.com/myphp_script.php</td>
</tr>
</table>
<p>The command above will run every 10 minutes. The slash allows for repeating, The <code>*</code> means it will be run every instance of the time period. Without the <code>/</code>, it would run on the tenth minute of the hour. Without the asterisk, it would (I think) need an hour designated on which to run it.</p>
<p>Commas and dashes should be used to designate multiple items in any section. For example:</p>
<pre>01,31 04,05 1-15 1,6 * /usr/bin/somedirectory/somecommand</pre>
<p>would run on the 1st and 31st minutes of 4 and 5am on the Jan 1-15 and June 1-15.</p>
<pre>30 0 * * sun,wed /usr/bin/somedirectory/somecommand</pre>
<p>...would run at 12:30am (0030 hours) each Sunday and Wednesday.</p>
<p>For more detailed information about Cron, see the <a href="https://help.ubuntu.com/community/CronHowto">Ubuntu Cron Reference Guide</a>.</p>
</div>
<div id="footer" class="centered">
<p xmlns:dct="http://purl.org/dc/terms/" xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#">
<a rel="license"
href="http://creativecommons.org/publicdomain/zero/1.0/">
<img src="http://i.creativecommons.org/p/zero/1.0/88x31.png" style="border-style: none;" alt="CC0" />
</a>
<br />
To the extent possible under law,
<a rel="dct:publisher"
href="http://ruthtillman.com">
<span property="dct:title">Ruth Tillman</span></a>
has waived all copyright and related or neighboring rights to
<span property="dct:title">Code Reference Project</span>.
This work is published from:
<span property="vcard:Country" datatype="dct:ISO3166"
content="US" about="http://code.ruthtillman.com">
United States</span>.
</p>
</div>
</div>
</body>
</html>