Skip to content

Instantly share code, notes, and snippets.

@bblanchon
Created April 14, 2015 20:20
Show Gist options
  • Save bblanchon/64ab8efebc51ec26a381 to your computer and use it in GitHub Desktop.
Save bblanchon/64ab8efebc51ec26a381 to your computer and use it in GitHub Desktop.
Automatically upgrade Ghost
#
# Automatically upgrade Ghost
# Benoit Blanchon 2014-2015 - MIT License
set -eu
GHOST_DIR=/var/www/blog.benoitblanchon.fr
function ghost_version {
npm -j ls ghost | jq -r .version
}
date
cd $GHOST_DIR
echo -n "Current version: "
ghost_version
echo "[0] Download"
rm -f ghost-latest.zip
wget -q http://ghost.org/zip/ghost-latest.zip
set +e
echo "[1] Stop service"
service ghost stop
echo "[2] Replace"
rm -rf core/
unzip -uo ghost-latest.zip -d $GHOST_DIR
echo "[3] npm install"
npm install --production
echo "[4] Start service"
service ghost start
echo -n "Version is now: "
ghost_version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment