Skip to content

Instantly share code, notes, and snippets.

@olancheg
Created July 30, 2012 06:41
Show Gist options
  • Save olancheg/3205358 to your computer and use it in GitHub Desktop.
Save olancheg/3205358 to your computer and use it in GitHub Desktop.
god init script
#!/bin/sh
# god init file for starting up the god daemon
#
# chkconfig: - 20 80
# description: Starts and stops the god daemon.
name="god"
user="deployer"
GOD_CMD="bundle exec god"
WORKING_DIR="~/current"
start() {
echo -n $"Starting $name: "
su - $user -c "cd $WORKING_DIR && $GOD_CMD -c config/application.god"
return $?
}
stop() {
echo -n $"Stopping $name: "
su - $user -c "cd $WORKING_DIR && $GOD_CMD quit"
return $?
}
restart() {
stop
start
}
case "$1" in
start)
$1
;;
stop)
$1
;;
restart)
$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