<?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>Blog dot Melimato dot Com &#187; linux</title>
	<atom:link href="http://blog.melimato.com/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.melimato.com</link>
	<description>Those things we do</description>
	<lastBuildDate>Fri, 29 Jul 2011 09:24:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Set new logrotate tasks to rotate apache logs in non-standard directories</title>
		<link>http://blog.melimato.com/set-new-logrotate-tasks-to-rotate-apache-logs-in-non-standard-directories/</link>
		<comments>http://blog.melimato.com/set-new-logrotate-tasks-to-rotate-apache-logs-in-non-standard-directories/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 15:52:36 +0000</pubDate>
		<dc:creator>pedro</dc:creator>
				<category><![CDATA[logrotate]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[log]]></category>

		<guid isPermaLink="false">http://www.melimato.com/blog/?p=64</guid>
		<description><![CDATA[I prefer compressing old logs to save space. Edit logrotate.conf vi /etc/logrotate.conf Uncomment the following line: compress Since I keep all my hosting&#8217;s logs in /home/hosting/log I need to add a new task to logrotate: Create a new file under logrotate.d called hosting: vi /etc/logrotate.d/hosting Add the following contents to that file: /home/hosting/*/log/*.log &#123; weekly [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.melimato.com%2Fset-new-logrotate-tasks-to-rotate-apache-logs-in-non-standard-directories%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.melimato.com%2Fset-new-logrotate-tasks-to-rotate-apache-logs-in-non-standard-directories%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I prefer compressing old logs to save space. Edit logrotate.conf</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>logrotate.conf</pre></div></div>

<p><span id="more-64"></span></p>
<p>Uncomment the following line:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">compress</pre></div></div>

<p>Since I keep all my hosting&#8217;s logs in /home/hosting/log I need to add a new task to logrotate:</p>
<p>Create a new file under logrotate.d called hosting:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>logrotate.d<span style="color: #000000; font-weight: bold;">/</span>hosting</pre></div></div>

<p>Add the following contents to that file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>hosting<span style="color: #000000; font-weight: bold;">/*/</span>log<span style="color: #000000; font-weight: bold;">/*</span>.log <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  weekly
    missingok
    rotate <span style="color: #000000;">52</span>
    compress
    delaycompress
    notifempty
    create <span style="color: #000000;">640</span> root adm
    sharedscripts
    postrotate
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #ff0000;">&quot;<span style="color: #780078;">`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/apache2.pid}`</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
            <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 reload <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
        <span style="color: #000000; font-weight: bold;">fi</span>
    endscript
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>Explanation of script lines according to man page:</p>
<p><strong>missingok</strong><br />
If the log file is missing, go on to the next one without issuing an error message.</p>
<p><strong>rotate</strong> <em>count</em><br />
Log files are rotated <count> times before being removed or mailed to the address specified in a mail directive. If count is 0, old versions are removed rather then rotated.<br />
In our case we will remove logfiles older than 1 year (52 weeks)</p>
<p><strong>compress</strong><br />
Duh!</p>
<p><strong>delaycompress</strong><br />
Postpone compression of the previous log file to the next rotation cycle. This has only effect when used in combination with compress. It can be used when some program can not be told to close its logfile and thus might continue writing to the previous log file for some time.</p>
<p><strong>notifempty</strong><br />
Do not rotate the log if it is empty (this overrides the ifempty option).</p>
<p><strong>create</strong> <em>mode owner group</em><br />
Immediately after rotation (before the postrotate script is run) the log file is created (with the same name as the log file just rotated).  mode specifies the mode for the log file in octal (the same as chmod(2)), owner specifies the user name who will own the log file, and group specifies the group the log file will belong to. Any of the log file attributes may be omitted, in which case those attributes for the new file will use the same values as the original log file for the omitted attributes. This option can be disabled using the nocreate option.</p>
<p><strong>sharedscripts</strong><br />
Normally, <strong>prescript</strong> and <strong>postscript</strong> scripts are run for each log which is rotated, meaning that a single script may be run multiple times for log file entries which match multiple files (such as the /var/log/news/* example). If <strong>sharedscript</strong> is specified, the scripts are only run once, no matter how many logs match the wildcarded pattern. However, if none of the logs in the pattern require rotating, the scripts will not be run at all. This option overrides the nosharedscripts option and implies <strong>create</strong> option.<br />
<strong>postrotate/endscript</strong><br />
The lines between postrotate and endscript (both of which must appear on lines by themselves) are executed after the log file is rotated. These directives may only appear inside of a log file definition.</p>
<div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li><a href="http://blog.melimato.com/svn-setup-and-migration/" rel="bookmark" class="wherego_title">svn setup and migration</a></li><li><a href="http://blog.melimato.com/make-svnserve-load-on-startup-ubuntu/" rel="bookmark" class="wherego_title">Make svnserve load on startup (Ubuntu)</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.melimato.com/set-new-logrotate-tasks-to-rotate-apache-logs-in-non-standard-directories/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>How to sync date/time in Ubuntu Intrepid</title>
		<link>http://blog.melimato.com/how-to-sync-datetime-in-ubuntu-intrepid/</link>
		<comments>http://blog.melimato.com/how-to-sync-datetime-in-ubuntu-intrepid/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 14:55:39 +0000</pubDate>
		<dc:creator>pedro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apt]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[chrony]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ntp]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.melimato.com/blog/?p=9</guid>
		<description><![CDATA[In order to keep my servers always showing the correct date/time I use a little software called chrony and make sure I&#8217;m using the correct time zone. All the actions below need superuser privileges To install it simply use apt-get: $ apt-get install chrony Once you&#8217;ve installed chrony you need to select your current time [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.melimato.com%2Fhow-to-sync-datetime-in-ubuntu-intrepid%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.melimato.com%2Fhow-to-sync-datetime-in-ubuntu-intrepid%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>In order to keep my servers always showing the correct date/time I use a little software called <a href="http://chrony.sunsite.dk/" title="chrony website">chrony</a> and make sure I&#8217;m using the correct time zone.</p>
<p><span id="more-9"></span></p>
<p><strong>All the actions below need superuser privileges</strong></p>
<p>To install it simply use apt-get:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> chrony</pre></div></div>

<p>Once you&#8217;ve installed chrony you need to select your current time zone:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ tzselect</pre></div></div>

<p>To make sure it is selected on every boot I just export the TZ environment variable in my /etc/rc.local</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc.local</pre></div></div>

<p>And add the following lines:<br />
# Export timezone<br />
TZ=&#8217;Europe/Brussels&#8217;; export TZ</p>
<p>I found doing the above was not enough, so I also edited my /etc/timezone file and added the correct time zone there:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Europe/Brussels&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>timezone</pre></div></div>

<p>And still it wasn&#8217;t enough, so I reconfigured the package tzdata</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ dpkg-reconfigure tzdata</pre></div></div>

<p>And finally that did it! To make sure it would still be correct on a future reboot I rebooted my machine:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ reboot</pre></div></div>

<div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.melimato.com/how-to-sync-datetime-in-ubuntu-intrepid/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

