Skip to content

Instantly share code, notes, and snippets.

@NanoSmasher
Last active October 26, 2015 20:41
Show Gist options
  • Save NanoSmasher/cdce664c6cd90c323108 to your computer and use it in GitHub Desktop.
Save NanoSmasher/cdce664c6cd90c323108 to your computer and use it in GitHub Desktop.
This script forces a UofT Skule Engineering website domain (*.skule.ca) to sync with a Github repository. More information in file.
#!/bin/bash
# This script forces a UofT Skule Engineering website domain (*.skule.ca) to sync with a Github repository.
# To run it, create a Cron Job with "bash sync.sh >> ~/sync.log 2>&1" and set an interval (like every 3 days).
# Don't forget to edit the GIT_USER and GIT_REPO variables or else you be using my website!
# The commands are only core utilies [cp, date, echo, export, unzip, wget] meaning it will work pratically anywhere.
# Define Github repository
export GIT_USER=NanoSmasher
export GIT_REPO=smash.skule.ca
# date for easy logging
echo ""
date
cd ~
rm -r ~/public_html/*
# copy the contents of _site from the github repo to public_html
wget -nv --no-check-certificate https://github.com/$GIT_USER/$GIT_REPO/archive/master.zip -O master.zip
wget -nv --no-check-certificate https://raw.githubusercontent.com/$GIT_USER/$GIT_REPO/master/.htaccess
unzip -qo master.zip
\cp -rf ~/$GIT_REPO-master/_site/* ~/public_html
\cp -rf ~/.htaccess ~/public_html
rm master.zip
rm ~/.htaccess
rm -r $GIT_REPO-master
echo "finished!"
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment