Skip to content

Instantly share code, notes, and snippets.

@Dirrk
Last active August 29, 2015 14:04
Show Gist options
  • Save Dirrk/4748e025c945e3bef29a to your computer and use it in GitHub Desktop.
Save Dirrk/4748e025c945e3bef29a to your computer and use it in GitHub Desktop.
Install ghost io
mkdir -p /opt/ghost/downloads
cd /opt/ghost/
mv /opt/ghost/*.zip /opt/ghost/downloads/
wget --no-check-certificate https://ghost.org/zip/ghost-latest.zip
unzip ghost-*.zip package.json
version=`cat package.json | grep "version" | cut -d: -f2 | tr -d ' ",'`
version=ghost-$version
if [ ! -e /opt/ghost/$version ]; then
unzip ghost-*.zip -d /opt/ghost/$version
mv /opt/ghost/*.zip /opt/ghost/downloads/
cd /opt/ghost/$version
npm install --production
result=$?
if [ -e /app/ghost ]; then
rm /app/ghost
fi
ln -s /opt/ghost/$version /app/ghost
else
result=0
fi
rm /opt/ghost/package.json
if [ $result -gt 0 ]; then
echo npm could not install ghost please check the logs
exit
fi
if [ ! -e /services/ghost ]; then
mkdir -p /services/ghost
echo "#!/bin/bash" > /services/ghost/run
echo "cd /app/ghost" >> /services/ghost/run
echo "exec nice -2 npm start" >> /services/ghost/run
chmod 755 /services/ghost/run
ln -s /services/ghost /service/ghost
else
ps -e f | grep 'node index' | grep -v grep | awk '{ print $1 }' | xargs kill -9
/command/svc -t /service/ghost
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment