<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jetpack Flight Log &#187; cron</title>
	<atom:link href="http://jetpackweb.com/blog/tags/cron/feed/" rel="self" type="application/rss+xml" />
	<link>http://jetpackweb.com/blog</link>
	<description>Rock{et}ing the interweb</description>
	<lastBuildDate>Wed, 19 May 2010 22:21:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Useful Linux Trick: cron  @reboot</title>
		<link>http://jetpackweb.com/blog/2009/07/17/useful-linux-trick-cron-reboot/</link>
		<comments>http://jetpackweb.com/blog/2009/07/17/useful-linux-trick-cron-reboot/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 17:19:03 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[cron]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=138</guid>
		<description><![CDATA[There are various ways to make sure something is run at system startup &#8211; Redhat has /etc/rc.local script, and it and many others have /etc/init.d/* scripts &#8211; but many times you might not have access to those files or creating init scripts might be overkill for your needs. People are always amazed when I tell [...]]]></description>
			<content:encoded><![CDATA[<p>There are various ways to make sure something is run at system startup &#8211; Redhat has <strong>/etc/rc.local</strong> script, and it and many others have <strong>/etc/init.d/*</strong> scripts &#8211; but many times you might not have access to those files or creating init scripts might be overkill for your needs.</p>
<p>People are always amazed when I tell them they can achieve this basic functionality by using cron. Many of our websites use <a href="http://sphinxsearch.com/" target="_blank">Sphinx</a>, the excellent full text indexer, to allow site searches. Should the server ever reboot, we need to make multiple search daemons start back up. Take the following line from a crontab:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;">crontab <span class="re5">-l</span>
&nbsp;
<span class="sy0">@</span>reboot <span class="sy0">/</span>usr<span class="sy0">/</span>local<span class="sy0">/</span>bin<span class="sy0">/</span>searchd <span class="re5">--config</span> ~<span class="sy0">/</span>conf<span class="sy0">/</span>sphinx.conf</pre></div></div>

<p>This will make sure the <i>searchd</i> daemon starts on bootup.</p>
<p>Also there are a few other shortcuts you can use:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="sy0">@</span>yearly        Run once a year, <span class="st0">&quot;0 0 1 1 *&quot;</span>.
<span class="sy0">@</span>annually      <span class="br0">&#40;</span>same <span class="kw2">as</span> <span class="sy0">@</span>yearly<span class="br0">&#41;</span>
<span class="sy0">@</span>monthly       Run once a month, <span class="st0">&quot;0 0 1 * *&quot;</span>.
<span class="sy0">@</span>weekly        Run once a week, <span class="st0">&quot;0 0 * * 0&quot;</span>.
<span class="sy0">@</span>daily         Run once a day, <span class="st0">&quot;0 0 * * *&quot;</span>.
<span class="sy0">@</span>midnight      <span class="br0">&#40;</span>same <span class="kw2">as</span> <span class="sy0">@</span>daily<span class="br0">&#41;</span>
<span class="sy0">@</span>hourly        Run once an hour, <span class="st0">&quot;0 * * * *&quot;</span>.</pre></div></div>

<p>See <strong>man 5 cron</strong> for more information.</p>
<p>(And to be pedantic, @reboot is run when cron is started or restarted, not necessarily the OS itself. So <strong>/etc/init.d/cron restart</strong> would trigger that line to be run. You may want to keep that in mind.)</p>
]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2009/07/17/useful-linux-trick-cron-reboot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
