2011
03.16

This is a pretty simple Powershell script that generates a random weekly status report and emails it. I wrote this script because it is important that I produce a weekly status report at my place of employment. The report is graded based on if it was submitted at all and secondly if it was submitted on time. As far as I know nobody actually reads these silly things as the process of checking them is automated. So if the “checker” is automated why shouldn’t the “reporter” be automated? The script is executed via a Scheduled Task.

Here is the script.

#
# Cobbled together by Don
#
# Lazy weekly reports
#

# Set the possible weekly activities
$wrkItems = @("Activity 1",
"Activity 2",
"Activity 3",
"Activity 4",
"Activity 5",
"Activity 6",
"Activity 7",
"Activity 8",
"Activity 9",
"Activity 10",
"Activity 11",
"Activity 12"
)

# Create the email body using three random elements
$outData = "My activities for the week may include but are not limited to:`n`n"
foreach ($ele in get-random -input 0,1,2,3,4,5,6,7,8,9,10,11 -count 3) {
$outData += " - "
$outData += $wrkItems[$ele]
$outData += "`n"
}

# Email the weekly report to the appropriate email address
$SMTPserver = "mail.yours.com"
$from = "don@nowhere.com"
$to = "WeeklyReports@nowhere.com"
$subject = "Don's Weekly Status Report"
$emailbody = $outData
$mailer = new-object Net.Mail.SMTPclient($SMTPserver)
$msg = new-object Net.Mail.MailMessage($from, $to, $subject, $emailbody)
$msg.IsBodyHTML = $false
$mailer.send($msg)

2011
03.09

I recently wanted/needed to upgrade Debian on my Beagleboard. The original Debian install was done following the instructions over at elinux.org. when I update distributions I usually prefer doing a clean install but since 90+% of my time on the Beagleboard is done while working remotely I thought I would give the upgrade route a try.

Before beginning I backed up my system. I took a copy of /etc, /var, /root, /home. I also made backups of my webmin config. Lastly I also took copies of all the binaries I have compiled (some needed major tuning). Once I was satisfied I could rebuild should I encounter a catastrophic meltdown during the upgrade I decided to proceed.

My first stop was a Google search on the subject. This yielded an excellent x86 centric guide over at HowtoForge. The first section of the guide detailing package cleanup was helpful as aptitude identified 27 packages that could be removed. My second avenue for information, given the unsatisfactory results from my Google searches, was the Beagleboard mailing list. I posted a message requesting steps for a Debian upgrade and got some immediate feedback. The Beagleboard group is great!

So, to recap, here is what I assembled from the HowtoForge and Beagleboard group posts as my upgrade procedure.

Clean up Apt source list file /etc/apt/sources.list, mine looked like this post clean-up:

deb http://ftp.ca.debian.org/debian lenny main
deb-src http://ftp.ca.debian.org/debian lenny main

deb http://security.debian.org/ lenny/updates main
deb-src http://security.debian.org/ lenny/updates main

deb http://volatile.debian.org/debian-volatile lenny/volatile main
deb-src http://volatile.debian.org/debian-volatile lenny/volatile main

# webmin
# deb http://download.webmin.com/download/repository sarge contrib

Next I cleaned up all the packages beginning with making sure the current distribution is up to date:

apt-get update
apt-get upgrade
apt-get dist-upgrade

Now I regularly update my system so no actions were required for the above commands. (I’ve written about apt-* before as I was learning about it)

Next was package cleanup, I followed the instructions by Deninix here exactly as he wrote them.

Ensure that no packages on hold with:

dpkg –audit
dpkg –get-selections | grep hold

For the final go ahead test use:

aptitude

Press g and the list shows which packages need your attention. In my case they were 27 packages listed as needing to be removed. So I removed them and then I was clean.

Next I followed the advice from the Beagleboard group.

I upgraded to the latest 2.6.35.x kernel for lenny using:

wget http://rcn-ee.net/deb/lenny/v2.6.35.9-x9/install-me.sh
/bin/bash install-me.sh

*I had to remove the “sudo” commands from the script

and rebooted.

Then I updated my sources list for squeeze, here’s what it looks like now

deb http://ftp.ca.debian.org/debian squeeze main
deb-src http://ftp.ca.debian.org/debian squeeze main

deb http://security.debian.org/ squeeze/updates main
deb-src http://security.debian.org/ squeeze/updates main

# deb http://volatile.debian.org/debian-volatile squeeze/volatile main
# deb-src http://volatile.debian.org/debian-volatile squeeze/volatile main

# webmin
# deb http://download.webmin.com/download/repository sarge contrib

Then I started the upgrade process with:
sudo apt-get update
sudo apt-get install apt aptitude udev
sudo aptitude update

The next recommned step was:
sudo aptitude safe-upgrade

I did run into some fairly significant issues with “aptitude safe-upgrade”. On the first pass just about all running processes on the beagleboard became defunct and nothing was working correctly. So I rebooted with an absolute minimal system running little more than kernel and sshd and ran “aptitude safe-upgrade” again. This time I let it run for 18+ hours and during that time the CPU was pegged at 100% and I was getting into some pretty serious swapping so I decided it wasn’t likely working as intended. I decided to move on with

sudo aptitude dist-upgrade

Here, dist-upgrade wanted to remove the “sysvconfig” package. I didn’t have any issues with this so I said “Yes”. The dist-upgrade command completely successfully and took about an hour.

I rebooted to make sure everything was sane. Next I decided to upgrade to the latest stable squeeze kernel with:

wget http://rcn-ee.net/deb/squeeze/v2.6.37.2-x4/install-me.sh
/bin/bash install-me.sh

*I had to remove the “sudo” commands from the script

I rebooted to make sure everything was sane. Next I tested a few of my applications:

Apache : ok
Webmin : Requested I re-detect the OS, after that it was OK
Anyterm : ok
munin : ok
Various scripts : ok

All and all it was a fairly painless process and was able to complete it without needing the console.