Skip to content

Instantly share code, notes, and snippets.

@shaunoconnor
Last active August 29, 2015 14:02
Show Gist options
  • Save shaunoconnor/98c47ce28f6887fc91e5 to your computer and use it in GitHub Desktop.
Save shaunoconnor/98c47ce28f6887fc91e5 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Based upon - Written by Andy Boutte and David Balderston of howtoinstallghost.com and allaboutghost.com
# updateghost_ami.sh will update your current Amazon ami ghost install to the latest version without you losing any content
if [[ `whoami` != root ]]; then
echo "This script must be run as root"
exit 1
fi
#Stop Ghost
pm2 stop all
#Make Tempory Directory and Download Lates Ghost
cd /var/www/ghost
mkdir temp
cd temp
wget https://github.com/TryGhost/Ghost/releases/download/0.4.1/Ghost-0.4.1.zip
unzip *.zip
cd ..
#Make Backup DB
cp content/data/ghost.db content/data/ghost_backup.db
echo "###### Data Backed Up ######"
#Copy the new files over
yes | cp temp/*.md temp/*.js temp/*.json .
rm -R core
yes | cp -R temp/core .
yes | cp -R temp/content/themes/casper content/themes
npm install --production
echo "###### NPM Installed ######"
#Delete temp folder
rm -R temp
chown -R ghost:ghost /var/www/ghost/
#Start Ghost Again
forever start index.js --name ghost
echo "###### Ghost Started ######"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment