Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@JeffGos
Last active February 8, 2017 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeffGos/d0efd75030b675425b82f20caf03bf6d to your computer and use it in GitHub Desktop.
Save JeffGos/d0efd75030b675425b82f20caf03bf6d to your computer and use it in GitHub Desktop.
Centos init script for ghost blogging tool
#!/bin/sh
#
# ghost - run ghost blogging tool
#
# https://ghost.org/developers/
. /etc/rc.d/init.d/functions
ghosthome="/var/www/ghost/"
exec="/usr/bin/node index.js >> /var/www/ghost/ghost.log &"
[ -e /etc/sysconfig/ghost ] && . /etc/sysconfig/ghost
start() {
echo -n $"Starting ghost"
export NODE_ENV=production
cd $ghosthome
daemon --user=ghost $exec
return $?
}
stop() {
echo -n $"Stopping ghost"
pid=`ps -u ghost -fw | grep ghost | grep -v " grep " | awk '{print $2}'`
kill -9 $pid > /dev/null 2>&1 && echo_success || echo_failure
return $?
}
restart() {
stop
start
}
case "$1" in
start)
$1
;;
stop)
$1
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 2
esac
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment