Script to upgrade Ghost to latest release
Here’s a tiny bash script for upgrading your Ghost installation to latest release version.
#!/bin/bash
# Script to upgrade Ghost, https://ghost.org/ to latest release
# Copyright (C) 2014 Matthias Geisler - All Rights Reserved
# Permission to copy and modify is granted under the MIT license
# Last revised 1/31/2014
WORKING_DIR=~/
GHOST_DIR=path/to/your/ghost/install
doUpgrade() {
cd $WORKING_DIR
TIMESTAMP=$(date +%Y%m%d%H%M%S)
# create backup...
tar cfz ghost_$TIMESTAMP.tar.gz $GHOST_DIR
# download latest ghost...
wget --no-check-certificate -O ghost-latest.zip https://ghost.org/zip/ghost-latest.zip
# stop ghost service
svc -d ~/service/ghostservice
# remove old core/ dir
rm -rf $GHOST_DIR/core
# install update
unzip -uo ghost-latest.zip -d $GHOST_DIR
# install
cd $GHOST_DIR && npm install --production
cd $WORKING_DIR
# start ghost service
svc -u ~/service/ghostservice
# cleanup
rm $WORKING_DIR/ghost-latest.zip
}
echo ""
echo "Upgrading Ghost is super straightforward..."
echo ""
echo "Did you backup all the data from your database?"
echo ""
echo "To export the blog settings and data log into your Ghost install and go to /ghost/debug/."
echo "Press the export button to download a JSON file containing all of your data."
echo ""
select yn in "Yes" "No"; do
case $yn in
Yes ) doUpgrade; break;;
No ) exit;;
esac
done
(Gist)