In the process of developing a method of automatically build the numerous Jekyll based sites I am now running I came across a couple of problems to do with deploying with git, through shell scripts launched by crontab.

Architecturally the sites receive content from shared folders which are symbolically linked in to the Jekyll site folders. A shell script script that is launched by cron runs Jekyll and then use git to version and push the site onto the web server.

Firstly the users own crontab, editable as crontab -e, runs with a different executable path so the user path must be explicitly set within the shell script being used.

export PATH=""

Once the path was set correctly the next issue I faced was the failure of git push commands with this error message.

ssh_exchange_identification: read: Connection reset by peer fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

I gather this is again caused by cron, as cron is unable to access or use the users ssh keys even if they do not require pass phrases. However on Ubuntu 14.04 LTS this can be resolved by prefixing the git command with the home directory path.

HOME=/home/bob git push origin master;

This makes the complete script,

export PATH="/usr/local/sbin:/usr/local/bin"

cd -complete path to folder-

if /usr/local/bin/jekyll build; then
        git add .;
        git commit -m "auto build";
        HOME=/home/bob git push origin master;
        echo "build error"

This script can then be launched from cron as required to cd into the build directory, run Jekyll to build the site and then push the site using git.

This works on Ubuntu 14.04 LTS as of today.

I have been exploring using sed to achieve a number of text manipulations in the course of rolling out a number of new Jekyll based websites.

Recently I have been working on streamlining the process of moving from the pre TheAudioPodcast show notes to the podcast feed notes after the show is recorded. The required differences between the files is achieved through the use of this single sed command.

 sed -e "s/v2post/post #v2post/g" -e "s_permalink: /show/\([0-9]*\)/_permalink: /show/\1.html_" $FILENAME > output-$FILENAME 

The command changes the yaml front matter in two ways. Firstly the command,

"s/v2post/post #v2post/g"

changes all values ‘v2post’ into ‘post #v2post’.

Secondly the command,

"s_permalink: /show/\([0-9]*\)/_permalink: /show/\1.html_"

changes the permalink yaml entry from ‘/show/99/’ in to ‘/show/99.html’.

The second command also demonstrated the ability to choose the command delimiter for sed. The first command uses ‘/’ while the second command uses ‘_’.

After a number of weeks of work I have finally completed the move of away from the wordpress site of the last few years and onto a Jekyll built static site.

While Wordpress has served me well for the last few years the effort of maintaining multiple wordpress installs, constantly plugging security holes and trying to keep the site nice and fast in use has a become a time drain.

So I felt it was time to try a static site approach. Static sites remove the hassle of maintaining dynamic server and instead allow you to just build pure HTML files instead. This means that every page has a unique file representing it and also that the site is much quicker to serve.

I also felt it would be time to have a little redesign as well and so have shifted to pre-processors as well.

While I have tried to maintain URLs I suspect that some will have been lost as this is the forth website that has occupied this URL since my first blog post on the 7th April 2008.

This past February half term, Susanna and I spent some of the holiday with friends at Rydal Hall just north of Ambleside in the Lake District. Rydal Hall has a variety of accommodation available but Susanna and I decided to camp which was a lot of fun but not without its challenges.

Firstly a big disclaimer, even though we did not know it when booking, Rydal Hall actually has a brand new (as of 2015) shower block with under-floor heating which made things really easy. Camping in the winter is actually a lot of fun it just needs a little extra planning.

While the expensive way to go winter camping is to buy specialist equipment when your camping near a car there is no need rather, just go for lots of duvets. Also don’t just put them over the top, put one underneath as well. In total Susanna and I used a blanket, roll mat and duvet underneath ourselves, then a zero degree rated sleeping bag with a cotton sleeping sock inside it. Finally a duvet and blanket over the top.

A cool trick we found after the first night was to place a blanket at the very top so than when the air in the tent condensed over night only a blanket got damp rather than a duvet. Susanna and I were comfortable camping throughout the holiday and at times even a little to warm.

As for Rydal Hall it was a great campsite, the large area we had to camp in was flat and well drained due to what I presume was hard standing installed under the turf though this did cause a few peg bending issues.

Ambleside is near by, you can watch planes pass over head at low level also the Badger pub which is very welcoming is just ten minutes walk away.