18 September 2014

This is an example of a little shell script that I got from cboettig and edited a little. It sends the updated code to both github, and also to my AWS server quickly and efficiently. Just insert the correct names for your own servers and it should work for you too.

#!/bin/bash

## Script modified from https://github.com/cboettig/labnotebook/blob/master/publish.sh

## Compile the site
jekyll build

## Copy site to repository for github hosting
git add -A
git commit -m "update site $(date +"%x %r")"
git pull (name of your github repository here) master
git push (name of your github repository here) master
echo "Site updated $(date +"%x %r") on Github server"

## Send site to Amazon S3 for web hosting
s3cmd sync --delete-removed _site/ s3://(name of your AWS bucket here)
echo "Site updated $(date +"%x %r") on Amazon S3"

The settings require that you have the s3cmd app from AWS installed on Linux. It will also remove any files from your AWS server that you have removed from your local Jekyll directory so be careful!

I hope it works for you.

J