Wednesday, 10 July 2013

New version of update-dnsomatic

I've had a change request for update-dnsomatic! A fairly sensible one, as it happens, to force updates even if the IP address hasn't changed.

There is a new parameter, force, in the config file to set the value in days, eg:

force=7

will force an update if /etc/update-dnsomatic/myip is older than seven days. The default value is 7.

You can download the new version (0.2.1) here.

Wednesday, 12 June 2013

Drop-in replacement for @big_ben_clock

Yesterday, @big_ben_clock announced it was going off-line for a while which was a shame as I like the hourly timestamp in my twitter stream.

I thought that I'd offer an identical service using my hardly-used @pwntter twitter account until such time as @big_ben_clock comes back on-line.

Code:  There's two bash scripts, one to generate the BONGs and one to tweet them using TTYtter.


#!/bin/sh
#bong
#bong n hours of the time (12 hour clock) mimicking @big_ben_clock

I=$(date +'%l')

for (( i=1; i <= $I; i++ ))
do
     echo -n "BONG "
done


#!/bin/sh
#bigben
#tweet bigben bongs while @big_ben_clock is down
TWEET=$(bong)
/usr/bin/ttytter -keyf="/home/prawn/.ttytterkeypwntter" -ssl=1 -norc -hold=5 -status="$TWEET"

Simply use cron to fire off the bigben script on the hour.

Wednesday, 16 January 2013

update-dnsomatic and dig

I have been using update-dnsomatic on my home server for some years now and it has worked well. Yesterday, I noticed that an update had 'worked' but the DNS entry had not propagated for some reason or other.

As a result of this, I have written a quick script that compares my public IP with a dig query which sends me a DM via twitter to let me know when they are different.

Files below: digip, cihip (Can I Haz IP), dmpr4wn

You need dnsutils (for dig) and a working copy of TTYtter for this to work.

Simply run digip every half hour or so and any discrepancy will be notified via twitter direct message.

Code:

#!/bin/sh
# digip
DIG=$(dig prawn.mooo.com | grep ^prawn.mooo.com | awk '{ print $5 }')
CIH=$(cihip)

if [ "$CIH" == "" ]
then
        echo "Public IP address is blank. Exiting."
        exit 1
fi

if [ "$DIG" == "" ]
then
        echo "DNS IP address is blank. Exiting."
        exit 2
fi


if [ "$DIG" != "$CIH" ]
then
       echo "Dig IP $DIG does not match public IP $CIH"
dmpr4wn "Dig IP $DIG does not match public IP $CIH"
else
echo "Dig IP $DIG matches public IP $CIH ok"
fi

###########################


#!/bin/sh
#cihip Can I haz IP
wget -qO - http://myip.dnsomatic.com/
echo

##########################

#!/bin/sh
#dmpr4wn
TWEET="/dm pr4wn"
ttytter -status="$TWEET $1" -hold

Sunday, 13 January 2013

Tweeting uptime

I thought I'd write a quick bash script to tweet uptimes for my machines using TTYtter.

It's a simple enough script which I intend to run once a week (so as not to pollute followers timelines).

So, here it is:

#!/bin/sh
#twuptime.sh
TWEET="Uptime for $(hostname) is $(date '+%d/%m/%Y') $(uptime)" 
ttytter -status="$TWEET"