<?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>Paul Tow &#187; Ubuntu</title>
	<atom:link href="http://www.paultow.com/tag/ubuntu/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.paultow.com</link>
	<description>Tech writer for hire</description>
	<lastBuildDate>Thu, 24 Dec 2009 21:32:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>How to: Use Twitter for software update notifications</title>
		<link>http://www.paultow.com/2007/07/10/use-twitter-for-software-update-notifications/</link>
		<comments>http://www.paultow.com/2007/07/10/use-twitter-for-software-update-notifications/#comments</comments>
		<pubDate>Tue, 10 Jul 2007 05:14:10 +0000</pubDate>
		<dc:creator>Paul Tow</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[apt-get]]></category>
		<category><![CDATA[aptitude]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[notification]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://macskeeball.wordpress.com/2007/07/10/using-twitter-for-software-update-notifications/</guid>
		<description><![CDATA[Putting the above pieces together, it is possible for you to set your server to periodically check for updates and then, if it finds any, update a Twitter status with alsit of available updates. You can then subscribe to the Twitter feed in a feed reader, or better yet use a service such as Feedburner, Yahoo! Alerts, or RMail to receive email notification when the Twitter feed is updated.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.twitter.com"><img class="alignright" title="Twitter bird" src="http://twitter.com/images/press-bird.gif" alt="" width="141" height="110" /></a>When running a server, security is a major concern. Part of that means keeping the software up to date, and package managers make it very easy to update all of the software installed on a Linux system in one fell swoop. However, the person maintaining the server still needs to be made aware that updates are available, and servers are often headless. While it&#8217;s true that tools such as cron-apt are available to receive update notification via email, such tools require the user to run their own mail server, which many ISPs block in an effort to reduce spam. Fortunately, it is possible to get around this using <a href="http://www.twitter.com">Twitter</a>.<span id="more-12"></span></p>
<p>Twitter is a popular web service that lets its users post short status messages and is intended to be used for keeping friends up to date on whatever it is you may be doing at a given moment. However, these status messages are really just free form blobs of text (containing a maximum of 140 characters) with RSS feeds to monitor updates. There are many different ways to update a Twitter status, including from the command line. Actions that can be performed non-interactively in the command line can be scheduled to run automatically on a regular basis.</p>
<p>Putting the above pieces together, it is possible for you to set your server to periodically check for updates and then, if it finds any, update a Twitter status used for self notifications with a list of available updates. You can then subscribe to the Twitter feed in a feed reader, or better yet use a service such as <a href="http://www.feedburner.com">Feedburner</a>, <a href="http://alerts.yahoo.com">Yahoo! Alerts</a>, or <a href="http://www.r-mail.org">RMail</a> to receive email notification when the Twitter feed is updated. It turns out that this is not that hard to do.</p>
<ol>
<li>With root privileges, use your favorite text editor to put the following shell script into a text file in /etc/cron.daily. I suggest naming it cron-apt-twitter
<pre>#!/bin/bash
#
# Cron Script - run from /etc/crontab or /etc/cron.daily
#
# Check for updates and updates Twitter status with list
# if any are found.

if [[ `apt-get update 2&gt;&amp;1 | grep Get` ]]; then
  if [[ `apt-get --simulate dist-upgrade 2&gt;&amp;1 | grep Inst` ]]; then
    curl -s -o /dev/null --basic --user USERNAME:PASSWORD --data status="`apt-get -q --simulate dist-upgrade`" http://twitter.com/statuses/update.xml
  fi
fi</pre>
</li>
<li>Don&#8217;t forget to replace USERNAME and PASSWORD with the username and password for the Twitter account.</li>
<li>Make the shell script executable by running this command:
<pre>sudo chmod +x /etc/cron.daily/cron-apt-twitter</pre>
</li>
<li>Make a temporary post to Twitter so that you can get the link to the RSS feed.</li>
<li>Subscribe to the feed using a feed reader or get an email notification of feed updates via <a href="http://www.feedburner.com">Feedburner</a>, <a href="http://alerts.yahoo.com">Yahoo! Alerts</a>, or <a href="http://www.r-mail.org">Rmail</a></li>
</ol>
<p>This has been tested with Debian Etch 4.0, but should also work in Debian-based distributions such as Ubuntu. With a few modifications to the shell script, this should also be possible to do with other distributions&#8217; such as Fedora.</p>
<p>Credits: The shell script is based on a combination of <a href="http://www.mattiaswikstrom.net/linux/20050526-apt-update-script.html">Mattias Wikistrom&#8217;s  Apt Update Script</a> and a Sakana article called <a href="http://www.sakana.fr/blog/2007/03/18/scripting-twitter-with-curl/">&#8220;Scripting Twitter with cURL.&#8221;</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.paultow.com/2007/07/10/use-twitter-for-software-update-notifications/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

