PATHのオプションつけて起動すればうまく動いた。 肝はここだったかぁ sudo su -l ${USER} -c "cd ${RAILS_ROOT_DIR} && bundle exec unicorn_rails --path /myapp1 -c ${UNICORN_CONF} -D" しょうもないとこにはまってたなぁ。 $ sudo vi /etc/init.d/unicorn_myapp1 -------------------------------------------------------------------------------- #!/bin/sh # chkconfig: 345 90 20 # description: Rails application sample # processname: unicorn_sample RAILS_ENV=production SERVICE=myapp1 USER=vagrant RAILS_ROOT_DIR="/home/vagrant/railsapp/myapp1/" PID=${RAILS_ROOT_DIR}/tmp/pids/unicorn.pid UNICORN_CONF=${RAILS_ROOT_DIR}/config/unicorn.rb UNICORN_ALIVE=`ps aux|grep '${UNICORN_CONF}'|grep -v grep|wc -l` start() { if [ $UNICORN_ALIVE = 0 ]; then rm -f $PID fi if [ -e ${PID} ]; then echo "${SERVICE} already started" exit 1 fi echo "start ${SERVICE}" sudo su -l ${USER} -c "cd ${RAILS_ROOT_DIR} && bundle exec unicorn_rails --path /myapp1 -c ${UNICORN_CONF} -D" } stop() { if [ ! -e ${PID} ]; then echo "${SERVICE} not started" exit 1 fi echo "stop ${SERVICE}" kill -QUIT `cat ${PID}` } force_stop() { if [ ! -e ${PID} ]; then echo "${SERVICE} not started" exit 1 fi echo "stop ${SERVICE}" kill -INT `cat ${PID}` } reload() { if [ ! -e ${PID} ]; then echo "${SERVICE} not started" start exit 0 fi echo "reload ${SERVICE}" kill -USR2 `cat ${PID}` } restart() { if [ -e ${PID} ]; then stop sleep 3 fi start } case "$1" in start) start ;; stop) stop ;; force-stop) force_stop ;; reload) reload ;; restart) restart ;; *) echo "Syntax Error: release [start|stop|force-stop|reload|restart]" ;; esac --------------------------------------------------------------------------------
PATHのオプションつけて起動すればうまく動いた。 肝はここだったかぁ sudo su -l ${USER} -c "cd ${RAILS_ROOT_DIR} && bundle exec unicorn_rails...
=======================================
http://ift.tt/1abnmbU
May 26, 2016 at 02:58PM
=======================================
PATHのオプションつけて起動すればうまく動いた。
肝はここだったかぁ
sudo su -l ${USER} -c "cd ${RAILS_ROOT_DIR} && bundle exec unicorn_rails --path /myapp1 -c ${UNICORN_CONF} -D"
しょうもないとこにはまってたなぁ。
$ sudo vi /etc/init.d/unicorn_myapp1
--------------------------------------------------------------------------------
#!/bin/sh
# chkconfig: 345 90 20
# description: Rails application sample
# processname: unicorn_sample
RAILS_ENV=production
SERVICE=myapp1
USER=vagrant
RAILS_ROOT_DIR="/home/vagrant/railsapp/myapp1/"
PID=${RAILS_ROOT_DIR}/tmp/pids/unicorn.pid
UNICORN_CONF=${RAILS_ROOT_DIR}/config/unicorn.rb
UNICORN_ALIVE=`ps aux|grep '${UNICORN_CONF}'|grep -v grep|wc -l`
start()
{
if [ $UNICORN_ALIVE = 0 ]; then
rm -f $PID
fi
if [ -e ${PID} ]; then
echo "${SERVICE} already started"
exit 1
fi
echo "start ${SERVICE}"
sudo su -l ${USER} -c "cd ${RAILS_ROOT_DIR} && bundle exec unicorn_rails --path /myapp1 -c ${UNICORN_CONF} -D"
}
stop()
{
if [ ! -e ${PID} ]; then
echo "${SERVICE} not started"
exit 1
fi
echo "stop ${SERVICE}"
kill -QUIT `cat ${PID}`
}
force_stop()
{
if [ ! -e ${PID} ]; then
echo "${SERVICE} not started"
exit 1
fi
echo "stop ${SERVICE}"
kill -INT `cat ${PID}`
}
reload()
{
if [ ! -e ${PID} ]; then
echo "${SERVICE} not started"
start
exit 0
fi
echo "reload ${SERVICE}"
kill -USR2 `cat ${PID}`
}
restart()
{
if [ -e ${PID} ]; then
stop
sleep 3
fi
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
force-stop)
force_stop
;;
reload)
reload
;;
restart)
restart
;;
*)
echo "Syntax Error: release [start|stop|force-stop|reload|restart]"
;;
esac
--------------------------------------------------------------------------------
肝はここだったかぁ
sudo su -l ${USER} -c "cd ${RAILS_ROOT_DIR} && bundle exec unicorn_rails --path /myapp1 -c ${UNICORN_CONF} -D"
しょうもないとこにはまってたなぁ。
$ sudo vi /etc/init.d/unicorn_myapp1
--------------------------------------------------------------------------------
#!/bin/sh
# chkconfig: 345 90 20
# description: Rails application sample
# processname: unicorn_sample
RAILS_ENV=production
SERVICE=myapp1
USER=vagrant
RAILS_ROOT_DIR="/home/vagrant/railsapp/myapp1/"
PID=${RAILS_ROOT_DIR}/tmp/pids/unicorn.pid
UNICORN_CONF=${RAILS_ROOT_DIR}/config/unicorn.rb
UNICORN_ALIVE=`ps aux|grep '${UNICORN_CONF}'|grep -v grep|wc -l`
start()
{
if [ $UNICORN_ALIVE = 0 ]; then
rm -f $PID
fi
if [ -e ${PID} ]; then
echo "${SERVICE} already started"
exit 1
fi
echo "start ${SERVICE}"
sudo su -l ${USER} -c "cd ${RAILS_ROOT_DIR} && bundle exec unicorn_rails --path /myapp1 -c ${UNICORN_CONF} -D"
}
stop()
{
if [ ! -e ${PID} ]; then
echo "${SERVICE} not started"
exit 1
fi
echo "stop ${SERVICE}"
kill -QUIT `cat ${PID}`
}
force_stop()
{
if [ ! -e ${PID} ]; then
echo "${SERVICE} not started"
exit 1
fi
echo "stop ${SERVICE}"
kill -INT `cat ${PID}`
}
reload()
{
if [ ! -e ${PID} ]; then
echo "${SERVICE} not started"
start
exit 0
fi
echo "reload ${SERVICE}"
kill -USR2 `cat ${PID}`
}
restart()
{
if [ -e ${PID} ]; then
stop
sleep 3
fi
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
force-stop)
force_stop
;;
reload)
reload
;;
restart)
restart
;;
*)
echo "Syntax Error: release [start|stop|force-stop|reload|restart]"
;;
esac
--------------------------------------------------------------------------------
http://ift.tt/1abnmbU
May 26, 2016 at 02:58PM
コメント
コメントを投稿