Monthly Archives: May 2015

A Letter to Nick Clegg

Dear Nick,

This is not usually a political blog and is unlikely to be again. However, I wanted to write to you on behalf of the British people you have so faithfully served for the past 5 years. Sir, I salute you. You put people above politics, compassion above career and you gave our Government a heart. The way your party has been punished today is unfair and not a reflection of all you stood for and achieved. You can rightly be proud of your record and my hope is that history remembers you in the light you deserve.

So thank you Nick Clegg. We wish you well for the future and, personally, I wish you were still in Government fighting for those values which make such a difference to ordinary people.

Yours Sincerely,

Guy Morrell

Quick Ubuntu Package Update Script

I don’t want to have to remember to login to my syslog server and check for required updates. Here is the script I wrote and added to cron so that I don’t have to:


use Email::Sender::Simple qw(sendmail);
use Email::Simple;
use Email::Sender::Transport::Sendmail qw();
use Try::Tiny;

my $to = "noc\";
my $from = "root\";
my $subject = "update script";
my $body =  `/usr/bin/apt-get update && /usr/bin/apt-get upgrade -s`;

my $email = Email::Simple->create(
    header=>[To=>$to, From=>$from,

try {
} catch {
    print "Can't send mail: $_";

To get this to work I needed to install some packages:

apt-get install sendmail
apt-get install libemail-sender-perl 
apt-get install libemail-simple-perl


I then added my script to cron:

root@itssys01:~# crontab -l
# Edit this file to introduce tasks to be run by cron.
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').# 
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
# For more information see the manual pages of crontab(5) and cron(8)
# m h  dom mon dow   command
0 0 * * * /usr/local/bin/ > /dev/null

Now I get an email with a list of packages which would be updated were I to run the following:

/usr/bin/apt-get upgrade

I don’t want my system blindly updating itself so this way I can still check things over before committing.