The future is bright, the future is … green?

After years of hosting everything on Skynet on a series of home built PCs, I’ve migrated most of the hosted services to the good fellows at bytemark and I’m scaling skynet back to a leaner, greener machine.
Starting with a move to an ASRock A330GS. Future changes will include scaling back the PSU and getting a greener hard drive.

Fun with maildrop

Whilst I’m awaiting the resurrection of my /home drive I’ve had to resort to collecting my mail and storing it under a temporary account.

I decided to make a few changes to skynet based on the fact my spambayes db was stored on /home along with my .procmailrc so SpamAssassin was integrated with sendmail and maildrop was set as the system-wide LDA.

Here is a fun line from my new (and still developing) .mailfilter file.
if ( /^List-Id:.+\<freebsd-(.*)\.freebsd\.org\>$/ )
TARGET="FreeBSD."$MATCH1""

Which automatically puts FreeBSD mailing list items in to their own folder.

To clear up what was in my ever growing Inbox, it was a simple case of running

for file in *; do cat $file | maildrop; done in a copy of ~/Mail/cur

Whilst its not quite as defined as my old .procmailrc I think I may like maildrop …

New skynet feature.

A new feature has been added to Skynet today, a self-managed service monitor.

The script is provided below and is free for use on a beerware license.

As usual its FreeBSD only.

Enjoyu!

—begin—
#!/bin/sh

PATH=/sbin:/bin:/usr/sbin:/usr/bin

. /etc/rc.subr
load_rc_config ‘XXX’

unset local_rc

find_local_scripts_new
servers=$(rcorder -s nostart ${local_rc} 2>/dev/null)

check_pid () {
if [ -z “$6” ]
then
# no 6th paramater, assume not running
return 0
else
pid=${6%%.*}
return $(ps -ax ${pid} | grep ${pid} | wc -l)
fi
}
for server in ${servers}
do
check_pid $(${prefix}${server} status)
if [ ${?} -eq 0 ]
then
${prefix}${server} start > /dev/null 2>&1
fi
done