June 27th 2014

Keeping the Raspberry Pi Connected via Wi-fi

A few months ago, I set-up my Raspberry Pi with a wi-fi adapter. More recently, I’ve noticed that the wi-fi connection occasionally drops out, and the adapter never attempts to reconnect to the network. This is a problem if I’m trying to access the Pi via SSH.

At this stage, I’m still unsure as to why the wi-fi drops out. Initially, I thought there was an issue with my interfaces file however, adding “auto wlan0″ to it in an attempt to force a reconnect failed. Trawling through the syslog files revealed that when the wi-fi dropped, a “link beat lost” message was recorded. I was fairly certain it wasn’t a power supply issue messing with the USB ports so my next idea was to create a cron job to check the status of the wi-fi adapter. This solution worked and I have outlined the steps I used below.

First of all, you need to create a new bash script in the following location (note, I’m using nano as my text editor):

cd ~
sudo nano ../../usr/local/bin/wifiscript.sh

The file has the following permission (the user can execute the file)

sudo chmod 0100 ../../usr/local/bin/wifiscript.sh

Next up, here’s the script I used to check the status of the wi-fi connection. What does it do? The Pi attempts to ping Google. If the Pi cannot successfully ping Google, then the script ensures the wi-fi interface is down before bringing it back up. Else, the wi-fi is connected and no action needs to be taken (yay!).

#!/bin/bash
 
TESTIP=8.8.8.8
 
ping -c4 ${TESTIP} > /dev/null
 
if [ $? != 0 ]
then
    logger -t $0 "WiFi has gone down- run ifup"
    ifdown --force wlan0
    ifup wlan0
else
        logger -t $0 "WiFi is currently ok"
fi

Now we need to create a new cron job to schedule when the wifi script runs. The new cron job goes here:

cd ~
nano ../../etc/crontab

How to add the new cron job to crontab:

*/5 * * * * root    /usr/local/bin/wifiscript.sh >> /var/log/syslog 2>&1

The above line writes all the messages generated by the wifiscript.sh file to the syslog file (so “WiFi has gone down- run ifup” or “WiFi is currently ok”). The cron job is also scheduled to run every 5 minutes.

…and that should be it! Well, not quite. It’s probably a good idea to test if the script actually works.

Take the wi-fi interface down:

ifdown wlan0

Of course, this will break your SSH connection. Wait 5 minutes and the wi-fi interface should come back up, allowing you to SSH back into the Pi.

One last check. Have a look at the syslog file. You should see where the wi-fi disconnected and where it reconnected.

nano ../../var/log/syslog

Now you’re done!

Note: this is my first attempt at writing a bash script and a cron job so comments and criticism is welcome!  In the process of writing this blog post, I found Arne’s Blog to be particularly helpful.

June 1st 2014

Montrose Music Festival, High Street, 24th May 2014

High Street Montrose

After a great show by Status Quo the previous day, we headed to the High Street stage as part of the Montrose Music Festival. A large portion of the street was closed, with food vans and stalls (great atmosphere).

I was rather tired from the night before so I only managed to catch a couple of bands. The first one I saw was Estrella. They’re an 70′s/80′s inspired rock band, reminding me of Van Halen. I enjoyed their short set and ended up ordering their album when I got home. The second band I listened to was Millsyeck, hailing from Dundee. They’re also a rock band who performed a great cover of Sweet Child ‘O Mine.

It’s a pity I was so knackered on the Saturday- I wish I could have taken in a few more bands!

June 1st 2014

Status Quo, Montrose Music Festival, East Links, 23rd May 2014

Status Quo Montrose

Here’s my quick review of the brilliant Status Quo concert in Montrose as part of the Music Festival.

We arrived around 6.20pm, met up with a few folks and found a place in a crowd (centre). First up was the Montrose Pipe Band who played in an area to the right of the stage. I’m tiny so I couldn’t see what was going on although I heard them. Next up was the support act, The Holy Ghosts. I’d seen them in 2013 when they supported Toploader and I thought they were excellent (they were the best band I saw last year; Toploader were disappointing). The Holy Ghosts played a cracking 30 minute set including one of my favourite songs by the band, Don’t Come a Knockin’ On My Rock n Roll Coffin. When I got home that night, I ordered their new album.

After a short wait, Status Quo appeared on stage around 9pm, kicking off with Caroline. They ran through a number of their hits, with everyone singing along (I’ve included a setlist at the bottom of this post). I’m not going to go through every song but my highlights were Caroline, Beginning of the End, Whatever You Want and Rockin’ All Over the World. The Quo were on fine form with good, old bluesy guitar solos though they mentioned several times throughout the show that it was freezing (given that the Links are right next to the beach, I’m not surprised!). The show ended around 10.40pm after a storming encore.

But it wasn’t quite over yet….Just as everyone turned to leave, a fireworks display was set off from the surrounding sand dunes, which was beautiful. Definitely one of the best endings to a gig I’ve ever attended!

My only gripes: the fence surrounding the arena wasn’t covered up (apparently a health and safety issue- it was a little breezy). Cheapskates who hadn’t paid for a ticket were standing right next to the fence, watching the show for free. Well done for failing to support your local community folks. They were closer than some of the people at the back of the crowd who had paid for a ticket. The drunken behaviour of a few audience members was disappointing too (drunk people climbing on each others shoulders, almost falling on to other audience members).

Status Quo playing in Montrose is one of the biggest things to happen in the town. A fantastic show. I’ve got no idea how the Montrose Music Festival committee are going to top that!  Here’s to next year!

Setlist
———
Caroline
Paper Plane
Hold You Back
Rain
Rock ‘n’ Roll ‘n’ You
Beginning of the End
Medley: What You’re Proposing / Down the Dustpipe / Wild Side of Life / Railroad / Again and Again
Big Fat Mama
The Oriental
Creepin’ Up on You
In the Army Now
Roll Over Lay Down
Down Down
Whatever You Want
Rockin’ All Over the World

Encore:
Junior’s Wailing
Rock and Roll Music / Bye Bye Johnny

May 23rd 2014

Sarah Millican, Caird Hall, Dundee, 9th April 2014

A quick wee blog….

After having the tickets for 18 months, it was finally time to see Sarah Millican on her Home Bird tour!  First up was her support act, Jonathan Mayor who was hilarious (I’d like to see more of his material, he was great).  Sarah was next and performed her show in 2 halves.  I’m not going to spoil any of the jokes but she was brilliant and by the end, I was sore from laughing.  Phrase of the evening was “jab it on the heed!”.

On the way out, there was a collection for Macmillan Cancer Support, which I thought was a nice touch.

Fantastic show.

May 23rd 2014

West Side Story, Edinburgh Playhouse, 29th March 2014

After seeing Priscilla at the beginning of March, we took another trip to the Playhouse to see the classic musical West Side Story, which is touring the UK this year. Before I go any further, I’ll admit that I haven’t seen the film so I didn’t really know what to expect (other than the show revolved around 2 rival gangs in New York City, in the 1950′s).

The show itself was brilliant- almost a mix of opera and ballet, set to the music of Leonard Bernstein. In particular I enjoyed the dance-off in the first act. I found the end of the second half rather shocking- the juxtaposition of the comedy of “Gee, Officer Krupke” against the horrifying attack against Anita, followed by the tragedy of the ending. Without giving too much away, I didn’t expect it to end the way it did and myself and other audience members jumped up out of our seats at one point.

A great show and I might pop to Aberdeen to see it again in June.