Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Update website from github when changes on master
# Updating and refreshing code for
set -e
logger -i -p local1.notice -t cron "[notice] Host `hostname` ran WebAt25 auto-updater"
cd /srv/code/web25ee/docroot
su -c 'git remote update' renoirb > $output 2>&1
# Source:
COUNT=$(git rev-list HEAD...origin/master --count)
if [ "$COUNT" -ge "1" ]; then
su -c 'git pull' renoirb > $output 2>&1
salt 'webat25*' state.sls code.webat25 >> $output 2>&1
#salt 'memcache*' 'echo "flush_all" | nc localhost 11211'
#curl -H 'Fastly-Key: FASTLY_KEY' -H 'Content-Accept: application/json' -XPOST
logger -i -p local1.notice -t cron "[notice] Host `hostname` WebAt25 auto-update -- updated"
logger -i -p local1.notice -t cron "[notice] Host `hostname` WebAt25 auto-updater -- nothing to do"
exit 0
# Not sure of the validity of this
if [ "$code" -ne 0 ] ; then
logger -i -p local1.error -t cron "[error] Host `hostname` ran WebAt25 auto-updater and exited with nonzero status: $code"
cat $output
exit $code
cat $output
rm $output
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment