<?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>yo61.com</title>
	<atom:link href="http://yo61.com/feed" rel="self" type="application/rss+xml" />
	<link>http://yo61.com</link>
	<description>Web Operations &#38; System Administration in the wilds of North Yorkshire</description>
	<lastBuildDate>Wed, 01 Sep 2010 16:57:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Fedora 13 as a domu guest with xen 3.4.2 on CentOS 5.5</title>
		<link>http://yo61.com/fedora-13-as-a-domu-guest-with-xen-3-4-2-on-centos-5-5.html</link>
		<comments>http://yo61.com/fedora-13-as-a-domu-guest-with-xen-3-4-2-on-centos-5-5.html#comments</comments>
		<pubDate>Wed, 01 Sep 2010 16:57:55 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://yo61.com/?p=175</guid>
		<description><![CDATA[I wanted to install a Fedora 13 machine as a paravirtual domu guest on our CentOS 5.5, xen 3.4.2 host. I also wanted to provision it using koan/cobbler. I ran into a few problems along the way, but I got there in the end! Firstly, createrepo in CentOS 5.5 does not work with either the [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to install a Fedora 13 machine as a paravirtual domu guest on our CentOS 5.5, xen 3.4.2 host. I also wanted to provision it using koan/cobbler. I ran into a few problems along the way, but I got there in the end!</p>
<p><span id="more-175"></span>Firstly, createrepo in CentOS 5.5 does not work with either the Fedora 13 distribution image, or the Fedora 13 Updates repo. I got round that by rebuilding createrepo from Fedora 13 on CentOS 5.5 which was in itself a major undertaking as it also involved rebuilding several other packages which are dependencies of createrepo (yum, yum-utils,&nbsp;python-urlgrabber,&nbsp;python-pycurl, curl, libssh2).</p>
<p>Once I&#39;d got the F13 distro imported into cobbler, and mirrored the F13 Updates repo, I created the cobbler system entry and ran koan to kick off the PXE install. All seemed to work fine and the installation completed. However, when I tried to start the domu it wouldn&#39;t start. In /var/log/xen/xend.log I found this was the last line:</p>
<p><code>[2010-09-01 16:43:05 9717] DEBUG (XendBootloader:113) Launching bootloader as [&#39;/usr/bin/pygrub&#39;, &#39;--output=/var/run/xend/boot/xenbl.11641&#39;, &#39;/dev/mapper/vg_guests-mock--disk0&#39;]</code></p>
<p>On a hunch, I modified the kickstart to explicitly format the /boot partition as ext3 rather than the default ext4 and re-tried the install process. Bingo! pygrub in xen 3.4.2 on CentOS 5.5 doesn&#39;t work with ext4.</p>
]]></content:encoded>
			<wfw:commentRss>http://yo61.com/fedora-13-as-a-domu-guest-with-xen-3-4-2-on-centos-5-5.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updating Dell OMSA on CentOS</title>
		<link>http://yo61.com/updating-dell-omsa-on-centos.html</link>
		<comments>http://yo61.com/updating-dell-omsa-on-centos.html#comments</comments>
		<pubDate>Tue, 31 Aug 2010 12:08:14 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[dell]]></category>
		<category><![CDATA[omsa]]></category>

		<guid isPermaLink="false">http://yo61.com/?p=171</guid>
		<description><![CDATA[Dell distributes its OMSA software in RPM packages and even has a yum repo available so you&#39;d think that updating to the next version would be as simple as yum update, right? Wrong! You have to remove the old version first, and then install the new version. Oh, and you also need to stop the [...]]]></description>
			<content:encoded><![CDATA[<p>Dell distributes its OMSA software in RPM packages and even has a yum repo available so you&#39;d think that updating to the next version would be as simple as <code>yum update</code>, right? Wrong!</p>
<p>You have to remove the old version first, and then install the new version. Oh, and you also need to stop the Dell services, restart ipmi, then restart the Dell services.</p>
<p>Something like this:</p>
<pre>yum -y remove srvadmin-* \
  &amp;&amp; rm -Rf /opt/dell \
  &amp;&amp; yum -y install srvadmin-all dell_ft_install \
  &amp;&amp; srvadmin-services.sh stop \
  &amp;&amp; service ipmi restart \
  &amp;&amp; srvadmin-services.sh start</pre>
]]></content:encoded>
			<wfw:commentRss>http://yo61.com/updating-dell-omsa-on-centos.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Bash pitfalls</title>
		<link>http://yo61.com/bash-pitfalls.html</link>
		<comments>http://yo61.com/bash-pitfalls.html#comments</comments>
		<pubDate>Thu, 24 Jun 2010 13:00:03 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[shell scripts]]></category>

		<guid isPermaLink="false">http://yo61.com/?p=162</guid>
		<description><![CDATA[Some kind soul on #bash on Freenode recently pointed me at this excellent document: http://mywiki.wooledge.org/BashPitfalls (I ran into #20, in case you&#39;re wondering)]]></description>
			<content:encoded><![CDATA[<p>Some kind soul on #bash on Freenode recently pointed me at this excellent document:</p>
<p><meta content="text/html; charset=utf-8" http-equiv="content-type" /><a href="http://mywiki.wooledge.org/BashPitfalls">http://mywiki.wooledge.org/BashPitfalls</a></p>
<p>(I ran into <a href="http://mywiki.wooledge.org/BashPitfalls#for_i_in_.7B1..10.7D.3B_do_..2BAC8-something_.26.3B_done">#20</a>, in case you&#39;re wondering)</p>
]]></content:encoded>
			<wfw:commentRss>http://yo61.com/bash-pitfalls.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dell DRAC BBU auto-learn tests kill disk performance</title>
		<link>http://yo61.com/dell-drac-bbu-auto-learn-tests-kill-disk-performance.html</link>
		<comments>http://yo61.com/dell-drac-bbu-auto-learn-tests-kill-disk-performance.html#comments</comments>
		<pubDate>Tue, 27 Apr 2010 09:50:08 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dell]]></category>
		<category><![CDATA[drac]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://yo61.com/?p=152</guid>
		<description><![CDATA[We&#39;ve had a bunch of new servers in place for around 3 months now. They seem to be working well and are performing just fine. Then, out of the blue, our monitoring started throwing alerts on seemingly random servers. Our queues were building up &#8211; basically, database performance had dropped dramatically and our processing scripts [...]]]></description>
			<content:encoded><![CDATA[<p>We&#39;ve had a bunch of new servers in place for around 3 months now. They seem to be working well and are performing just fine.</p>
<p>Then, out of the blue, our monitoring started throwing alerts on seemingly random servers. Our queues were building up &#8211; basically, database performance had dropped dramatically and our processing scripts couldn&#39;t stuff data into the DBs fast enough.</p>
<p>What could be causing it?</p>
<p><span id="more-152"></span>I took a quick glance at our monitoring and various statistics confirmed the problems. You can clearly see in the following graphs that CPU Wait and Load Average increased at around 14:30, and at the same time MySQL throughput and command counters dropped dramatically:</p>
<p><img alt="CPU Usage" height="325" src="http://yo61.com/wp-content/uploads/b008_CPU.png" width="645" /></p>
<p><img alt="Load average" height="199" src="http://yo61.com/wp-content/uploads/b008_load.png" width="480" /></p>
<p><img alt="MySQL Network Traffic" height="286" src="http://yo61.com/wp-content/uploads/b008_mysql_net.png" width="645" /></p>
<p><img alt="MySQL Command Counters" height="403" src="http://yo61.com/wp-content/uploads/b008_mysql_commands.png" width="645" /></p>
<p>So, I&#39;ve found the symptoms; what could be the cause?</p>
<p>Digging around in the system logs, I found the following lines (emphasis is mine):</p>
<pre>Apr 26 12:55:31 b008 Server Administrator: Storage Service EventID: 2176  The controller battery Learn cycle has started.:  Battery 0 Controller 0
Apr 26 12:56:36 b008 Server Administrator: Storage Service EventID: 2266  Controller log file entry: Battery is discharging:  Battery 0 Controller 0
Apr 26 12:56:36 b008 Server Administrator: Storage Service EventID: 2248  The controller battery is executing a Learn cycle.:  Battery 0 Controller 0
Apr 26 14:21:52 b008 Server Administrator: Storage Service EventID: 2278  The controller battery charge level is below a normal threshold.:  Battery 0 Controller 0
Apr 26 14:21:53 b008 Server Administrator: Storage Service EventID: 2188  <strong>The controller write policy has been changed to Write Through</strong>.:  Battery 0 Controller 0
Apr 26 14:21:53 b008 Server Administrator: Storage Service EventID: 2199  The virtual disk cache policy has changed.:  Virtual Disk 0 (Virtual Disk 0) Controller 0 (PERC 6/i Adapter)
Apr 26 14:55:06 b008 Server Administrator: Storage Service EventID: 2177  The controller battery Learn cycle has completed.:  Battery 0 Controller 0
Apr 26 14:55:21 b008 Server Administrator: Storage Service EventID: 2247  The controller battery is charging.:  Battery 0 Controller 0
Apr 26 14:55:21 b008 Server Administrator: Storage Service EventID: 2278  The controller battery charge level is below a normal threshold.:  Battery 0 Controller 0
Apr 26 15:25:41 b008 Server Administrator: Storage Service EventID: 2279  The controller battery charge level is operating within normal limits:  Battery 0 Controller 0
Apr 26 15:25:41 b008 Server Administrator: Storage Service EventID: 2189  <strong>The controller write policy has been changed to Write Back</strong>.:  Battery 0 Controller 0
Apr 26 15:25:42 b008 Server Administrator: Storage Service EventID: 2199  The virtual disk cache policy has changed.:  Virtual Disk 0 (Virtual Disk 0) Controller 0 (PERC 6/i Adapter)
Apr 26 18:50:26 b008 Server Administrator: Storage Service EventID: 2358  The battery charge cycle is complete.:  Battery 0 Controller 0</pre>
<p>Bingo!</p>
<p>The RAID controller is running a battery learn cycle. When battery charge drops below a certain level, cache Write Back is disabled, and that kills disk performance.&nbsp;It seems this test is enabled by default and is configured to run every 90 days. Of course, Sod&#39;s law dictates that it has to trigger in our busy period!</p>
<p>The Dell tools are not able to turn off this feature, but the LSI MegaCli tool can (Dell PERC 6/i controllers are re-badged LSI cards). I&#39;ve run the following script on all servers (thanks to burr86 on ##infra-talk @ Freenode):</p>
<pre>#!/bin/sh
TMPFILE=$(mktemp -p /tmp bbu.relearn.off.XXXXXXXXXX) || exit 1
echo &quot;autoLearnMode=1&quot; &gt; $TMPFILE # or =0 to enable the bbu relearn
MegaCli -AdpBbuCmd -SetBbuProperties -f$TMPFILE -a0
rm -f $TMPFILE</pre>
<p>I wrote a puppet class to run this script on all nodes:</p>
<pre>class megacli::check {
    exec{&#39;perc_bbu_autolearn.sh&#39;:
        require =&gt; Class[&#39;megacli::install&#39;],
        cwd    =&gt; &#39;/tmp&#39;,
        path   =&gt; &#39;/usr/local/bin:/bin&#39;,
        unless =&gt; &#39;MegaCli -AdpBbuCmd -GetBbuProperties -a0 | grep -q &quot;Auto-Learn Mode: Disabled&quot;&#39;
    }
}</pre>
<div>All that remains to be done is to put a cron job in place that runs the battery learning cycle every three months at an off-peak time. The command to kick that off is:</div>
<pre><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: monospace; font-size: 13px; white-space: pre; ">omconfig storage battery action=startlearn controller=0 battery=0</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://yo61.com/dell-drac-bbu-auto-learn-tests-kill-disk-performance.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>MAC Addresses of embedded NICs on Dell servers through DRAC</title>
		<link>http://yo61.com/mac-addresses-of-embedded-nics-on-dell-servers-through-drac.html</link>
		<comments>http://yo61.com/mac-addresses-of-embedded-nics-on-dell-servers-through-drac.html#comments</comments>
		<pubDate>Thu, 22 Apr 2010 02:06:54 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dell]]></category>
		<category><![CDATA[drac]]></category>
		<category><![CDATA[racadm]]></category>

		<guid isPermaLink="false">http://yo61.com/?p=146</guid>
		<description><![CDATA[I use cobbler to provision our new Dell servers, which is great but it needs the MAC addresses of the servers to identify each machine. Previously, I have been doing this manually: log in to the DRAC web interface launch the java console rebooting the server go into the BIOS navigate to Embedded Devices manually [...]]]></description>
			<content:encoded><![CDATA[<p>I use cobbler to provision our new Dell servers, which is great but it needs the MAC addresses of the servers to identify each machine.</p>
<p>Previously, I have been doing this manually:</p>
<ol>
<li>log in to the DRAC web interface</li>
<li>launch the java console</li>
<li>rebooting the server</li>
<li>go into the BIOS</li>
<li>navigate to Embedded Devices</li>
<li>manually record the MAC addresses</li>
</ol>
<p>This takes quite a while, and is prone to error.</p>
<p>I recently had another 42 servers to deploy to I looked for a way to automate this process. I found one!<span id="more-146"></span></p>
<p>I got the inkling that this should be possible because I noticed that the System | Properties | System Details page in the DRAC web interface lists the MAC addresses in the Main System Chassis section:</p>
<pre><span class="Apple-style-span" style="white-space: pre; -webkit-border-horizontal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">Embedded NIC MAC Addresses
    NIC1  Ethernet<font class="Apple-style-span" face="monospace"><span class="Apple-tab-span" style="white-space:pre"> </span> a4:ba:db:11:38:2d
          iSCSI<span class="Apple-tab-span" style="white-space:pre"> </span>    00:00:00:00:00:00
   <span class="Apple-tab-span" style="white-space:pre"> </span>NIC2<span class="Apple-tab-span" style="white-space:pre"> </span> Ethernet<span class="Apple-tab-span" style="white-space:pre"> </span> a4:ba:db:11:38:2e
         <span class="Apple-tab-span" style="white-space:pre"> </span>iSCSI<span class="Apple-tab-span" style="white-space:pre"> </span>    00:00:00:00:00:00</font></span></pre>
<div>&nbsp;</div>
<div><span class="Apple-style-span" style="white-space: pre; -webkit-border-horizontal-spacing: 1px; -webkit-border-vertical-spacing: 1px;"><font class="Apple-style-span" face="monospace"><span class="Apple-style-span" style="font-family: Arial, Verdana, sans-serif; white-space: normal; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; ">So, I checked in the DRAC6 documentation for a suitable command, and found it: <code>racadm racdump</code></span></font></span></div>
<p>This dumps a whole load of information about the DRAC and the attached system. However, pass the output through a simple grep and &#8230; bingo!</p>
<pre>$ racadm -r $DRAC -u root -p calvin racdump | egrep &#39;^MAC Address|^NIC. Ethernet&#39;
MAC Address             = a4:ba:db:11:38:2f
NIC1 Ethernet           = a4:ba:db:11:38:2d
NIC2 Ethernet           = a4:ba:db:11:38:2e
NIC3 Ethernet           = N/A
NIC4 Ethernet           = N/A
</pre>
]]></content:encoded>
			<wfw:commentRss>http://yo61.com/mac-addresses-of-embedded-nics-on-dell-servers-through-drac.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>RPM packages for Toggl Desktop client</title>
		<link>http://yo61.com/rpm-packages-for-toggl-desktop-client.html</link>
		<comments>http://yo61.com/rpm-packages-for-toggl-desktop-client.html#comments</comments>
		<pubDate>Mon, 01 Mar 2010 22:44:33 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[rpm]]></category>
		<category><![CDATA[time tracking]]></category>
		<category><![CDATA[toggl]]></category>

		<guid isPermaLink="false">http://yo61.com/?p=138</guid>
		<description><![CDATA[I use the toggl time-tracking service to keep track of the hours I work for my various clients. toggl make available desktop clients for Windows, Mac, &#38; Linux, but the Linux packages are in .deb format for Ubuntu and, until recently, they did not provide x86_64 packages. toggl recently released the desktop client as open [...]]]></description>
			<content:encoded><![CDATA[<p>I use the <a href="http://www.toggl.com">toggl</a> time-tracking service to keep track of the hours I work for my various clients.</p>
<p>toggl make available desktop clients for Windows, Mac, &amp; Linux, but the Linux packages are in .deb format for Ubuntu and, until recently, they did not provide x86_64 packages.</p>
<p>toggl recently released the desktop client as open source so I grabbed it and have built an RPM.</p>
<p>SRPM: <a href="/download/2">TogglDesktop-2.5.1-1.fc12.src.rpm</a></p>
<p>RPM (Fedora 12, x86_64): <a href="/download/3">TogglDesktop-2.5.1-1.fc12.x86_64.rpm</a></p>
]]></content:encoded>
			<wfw:commentRss>http://yo61.com/rpm-packages-for-toggl-desktop-client.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dell OMSA on CentOS 5.4 x86_64 &#8211; No Controllers found error</title>
		<link>http://yo61.com/dell-omsa-on-centos-5-4-x86_64-no-controllers-found-error.html</link>
		<comments>http://yo61.com/dell-omsa-on-centos-5-4-x86_64-no-controllers-found-error.html#comments</comments>
		<pubDate>Thu, 11 Feb 2010 00:35:15 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[dell]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[omsa]]></category>

		<guid isPermaLink="false">http://yo61.com/?p=135</guid>
		<description><![CDATA[It seems that several people have been having problems getting Dell OMSA 6.2 to work correctly on CentOS 5.4 x86_64. Specifically, the software does not detect any storage controllers, and therefore also doesn&#39;t find any disks. eg. [root@b034 ~]# omreport storage pdisk controller=0 Invalid controller value. Read, controller=0 No controllers found. After a little investigation, [...]]]></description>
			<content:encoded><![CDATA[<p>It seems that several people have been having problems getting Dell OMSA 6.2 to work correctly on CentOS 5.4 x86_64. Specifically, the software does not detect any storage controllers, and therefore also doesn&#39;t find any disks. eg.</p>
<pre>[root@b034 ~]# omreport storage pdisk controller=0
Invalid controller value. Read, controller=0
No controllers found.
</pre>
<p>After a little investigation, I found the source of the problem.</p>
<p><span id="more-135"></span>It turns out that the i386 package of compat-libstdc++-33 is required, although it&#39;s not pulled in as a dependency by the srvadmin-whatever RPM.</p>
<pre>yum install compat-libstdc++-33.i386
service dataeng restart
</pre>
<p>Now, the same command works just fine:</p>
<pre>[root@b034 ~]# omreport storage pdisk controller=0
List of Physical Disks on Controller PERC 6/i Adapter (Slot 1)

Controller PERC 6/i Adapter (Slot 1)
ID                        : 0:0:0
Status                    : Ok
Name                      : Physical Disk 0:0:0
etc.
</pre>
]]></content:encoded>
			<wfw:commentRss>http://yo61.com/dell-omsa-on-centos-5-4-x86_64-no-controllers-found-error.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Building RPMs from Ruby gems</title>
		<link>http://yo61.com/building-rpms-from-ruby-gems.html</link>
		<comments>http://yo61.com/building-rpms-from-ruby-gems.html#comments</comments>
		<pubDate>Tue, 09 Feb 2010 12:03:14 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[rpm]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://yo61.com/?p=132</guid>
		<description><![CDATA[I often need to deploy Ruby gems across many CentOS servers. I prefer to use the native OS package management tools (rpm + yum) rather than using Ruby gems. Here&#39;s how to build RPMs from Ruby gems using gem2rpm. I am assuming you have the necessary build tools installed (if not, yum install rpmdevtools) and [...]]]></description>
			<content:encoded><![CDATA[<p>I often need to deploy Ruby gems across many CentOS servers. I prefer to use the native OS package management tools (rpm + yum) rather than using Ruby gems.</p>
<p>Here&#39;s how to build RPMs from Ruby gems using gem2rpm.</p>
<p><span id="more-132"></span>I am assuming you have the necessary build tools installed (if not, <tt>yum install rpmdevtools</tt>) and have already created an RPM build environment, eg:</p>
<pre><tt>~/rpmbuild
|-- BUILD
|-- RPMS
|-- SOURCES
|-- SPECS
`-- SRPMS
</tt></pre>
<p>First, make sure gem2rpm is installed:</p>
<pre><code>yum install rubygem-gem2rpm
</code></pre>
<p>Then, grab the gem you want to convert to an RPM:</p>
<pre>cd ~/rpmbuild/SOURCES
gem fetch capistrano
</pre>
<p>This will dump the gem file in the current directory, in this case: <tt>capistrano-2.5.14.gem</tt>.</p>
<p>Next, create a spec file:</p>
<pre>gem2rpm capistrano-2.5.14.gem  &gt; ../SPECS/rubygem-capistrano.spec
</pre>
<p>Finally, build the RPM(s):</p>
<pre>rpmbuild -ba ../SPECS/rubygem-capistrano.spec</pre>
]]></content:encoded>
			<wfw:commentRss>http://yo61.com/building-rpms-from-ruby-gems.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Useful date command format string</title>
		<link>http://yo61.com/useful-date-command-format-string.html</link>
		<comments>http://yo61.com/useful-date-command-format-string.html#comments</comments>
		<pubDate>Tue, 02 Feb 2010 13:17:58 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://yo61.com/?p=128</guid>
		<description><![CDATA[When creating backups or log files, I like to name the files with a timestamp, ie. the date plus the time. I use the date command to produce timestamps in the appropriate format, but I find the format specifier a bit long-winded and difficult to remember &#8211; is %m minutes or month? There is a [...]]]></description>
			<content:encoded><![CDATA[<p>When creating backups or log files, I like to name the files with a timestamp, ie. the date plus the time.</p>
<p>I use the <tt>date</tt> command to produce timestamps in the appropriate format, but I find the format specifier a bit long-winded and difficult to remember &#8211; is <tt>%m</tt> minutes or month?</p>
<p>There is a better way&#8230; <tt>date -I</tt></p>
<p><span id="more-128"></span>To make the strings sort in a sane manner, I find it best to use a format with the timestamp elements in descending order of size, eg. <tt>YYYYMMDDhhmmss</tt> which is produced with a format specifier like this:</p>
<pre># date +%Y%m%d%H%M%S
20100202130818
</pre>
<p>But as I&#39;ve mentioned, I find that to be a pain to remember. Wouldn&#39;t it be great if there was a single switch that produced a suitable timestamp format?</p>
<p>Well, it turns out that there is:&nbsp; <tt>--iso-8601</tt> or <tt>-I</tt>, with the <tt>seconds</tt> modifier:</p>
<pre># date -Iseconds
2010-02-02T13:07:40+0000
</pre>
<p>According to <tt>NEWS</tt> in the coreutils distribution:</p>
<pre>  date accepts the new option --rfc-3339=TIMESPEC.  The old --iso-8602 (-I)
  option is deprecated; it still works, but new applications should avoid it.
  date, du, ls, and pr&#39;s time formats now support new %:z, %::z, %:::z
  specifiers for numeric time zone offsets like -07:00, -07:00:00, and -07.
</pre>
<p>The &#8211;rfc-3339 option is similar, but it includes a space in the output, which I prefer to avoid:</p>
<pre># date --rfc-3339 seconds
2010-02-02 13:16:10+00:00
</pre>
<p>So, I&#39;ll be continuing to use <tt>-Iseconds</tt></p>
]]></content:encoded>
			<wfw:commentRss>http://yo61.com/useful-date-command-format-string.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing puppet manifests that can remove resources as well as adding them</title>
		<link>http://yo61.com/writing-puppet-manifests-that-can-remove-resources-as-well-as-adding-them.html</link>
		<comments>http://yo61.com/writing-puppet-manifests-that-can-remove-resources-as-well-as-adding-them.html#comments</comments>
		<pubDate>Fri, 29 Jan 2010 17:07:24 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[puppet]]></category>

		<guid isPermaLink="false">http://yo61.com/?p=123</guid>
		<description><![CDATA[I use puppet to manage the configuration of the machines I manage. So far, I&#39;ve been rolling out new resources to machines but recently I&#39;ve wanted to remove resources from machines. Here&#39;s how I modified my cron classes so I could remove cron jobs as well as create them. When I first wrote my cron [...]]]></description>
			<content:encoded><![CDATA[<p>I use puppet to manage the configuration of the machines I manage. So far, I&#39;ve been rolling out new resources to machines but recently I&#39;ve wanted to remove resources from machines. Here&#39;s how I modified my cron classes so I could remove cron jobs as well as create them.</p>
<p><span id="more-123"></span>When I first wrote my cron classes, I created a separate class for each cron job, eg.</p>
<pre>class app::queue_processor::cron::cacheload {

    include
        user::base

    cron { cacheload:
        command =&gt; &#39;/usr/bin/php /app/queue_processor/utils/cacheload.php account &gt; /dev/null 2&gt;&amp;1&#39;,
        hour    =&gt; &#39;0&#39;,
        minute  =&gt; &#39;0&#39;,
        user    =&gt; &#39;app&#39;,
        require =&gt; User[&#39;app&#39;]
    }

}
</pre>
<p>I then created another class for each profile which includes all the required cron jobs, eg:</p>
<pre>class profile::partition::cron {
    include
        app::queue_processor::cron::cacheload
        app::queue_processor::cron::send_move_backlog
}</pre>
<p>This all works fine and the cron jobs are installed as required. However, I recently needed to remove the <code>cacheload</code> cron job from all machines.</p>
<p>This is simply a matter of specifying &quot;ensure =&gt; absent&quot; to the cron type. I therefore needed some way of passing this to the cron job classes.</p>
<p>I did this by creating a higher-level cron class, <code>app::queue_processor::cron</code> containing a definition <code>app::queue_processor::cron::job</code> which takes an <code>ensure</code> parameter that defaults to &quot;<code>present</code>&quot; if not specified. It looks like this:</p>
<pre>class app::queue_processor::cron {}
define app::queue_processor::cron::job($ensure = present) {

    include user::base

    case $name {
        cacheload: {
            cron { $name:
                command =&gt; &#39;/usr/bin/php /app/queue_processor/utils/cacheload.php account &gt; /dev/null 2&gt;&amp;1&#39;,
                hour    =&gt; &#39;0&#39;,
                minute  =&gt; &#39;0&#39;,
                user    =&gt; &#39;app&#39;,
                require =&gt; User[&#39;app&#39;]
                ensure  =&gt; $ensure
            }
        }

        send_move_backlog: {
            cron { $name:
                # similar cron definition here
            }
        }

        default: { fail(&quot;Unknown queue_processor cron job type: $name&quot;) }
    }
}
</pre>
<p>I use this new define in the <code>profile::partition::cron</code> class like this:</p>
<pre>class profile::partition::cron {
    include app::queue_processor::cron
    app::queue_processor::cron::job{ send_move_backlog: }
    app::queue_processor::cron::job{ cacheload: ensure =&gt; absent }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://yo61.com/writing-puppet-manifests-that-can-remove-resources-as-well-as-adding-them.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
