Created
June 17, 2013 10:24
-
-
Save kozy4324/5795996 to your computer and use it in GitHub Desktop.
bundle execで動かすunicorn_railsのinit.dスクリプト(とりあえず動くVer.)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# mapi-on-rails - this script starts and stops the unicorn_rails daemon for mapi-on-rails | |
# | |
# chkconfig: - 90 10 | |
# description: unicorn_rails for mapi-on-rails | |
# Source function library. | |
. /etc/rc.d/init.d/functions | |
bundle="/usr/bin/bundle" | |
prog="unicorn_rails" | |
app_home="/home/www/your_rails" | |
conf_file="unicorn_rails.conf" | |
env="production" | |
lockfile="/var/lock/subsys/${prog}" | |
pidfile="/var/run/${prog}.pid" | |
start() { | |
echo -n $"Starting $prog: " | |
daemon "cd ${app_home}; ${bundle} exec ${prog} -c ${conf_file} --env ${env} -D" | |
retval=$? | |
echo | |
[ $retval -eq 0 ] && touch $lockfile | |
return $retval | |
} | |
stop() { | |
echo -n $"Stopping $prog: " | |
killproc -p $pidfile $prog | |
retval=$? | |
echo | |
[ $retval -eq 0 ] && rm -f $lockfile | |
return $retval | |
} | |
restart() { | |
stop | |
start | |
} | |
reload() { | |
echo -n $"Reloading $prog: " | |
killproc -p $pidfile $prog -HUP | |
echo | |
} | |
case "$1" in | |
start) | |
$1 | |
;; | |
stop) | |
$1 | |
;; | |
restart) | |
$1 | |
;; | |
reload) | |
$1 | |
;; | |
status) | |
status $prog | |
;; | |
*) | |
echo $"Usage: $0 {start|stop|reload|status|restart}" | |
exit 2 | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment