[英]Cannot Start Unicorn
我想重新啟動Unicorn,以查看我在某些View上本地所做的一些編輯。
我能夠阻止獨角獸。 由於某種原因,它將無法重新啟動。
這是它給我的錯誤:
Executing /etc/rc.d/init.d/unicorn_loadmax start ..
/etc/rc.d/init.d/unicorn_loadmax: line 20: kill: (24317) - No such process
master failed to start, check stderr log for details
這是我的獨角獸劇本
#!/bin/sh
set -e
# Example init script, this can be used with nginx, too,
# since nginx and unicorn accept the same signals
# Feel free to change any of the following variables for your app:
TIMEOUT=${TIMEOUT-60}
APP_ROOT=/home/deployer/loadmax/current
PID=/home/deployer/loadmax/shared/pids/unicorn.pid
CMD="cd /home/deployer/loadmax/current && bundle exec /home/deployer/loadmax/shared/bundle/ruby/1.9.1/bin/unicorn -D -c /home/deployer/loadmax/shared/config/unicorn.rb -E production"
AS_USER=deployer
action="$1"
set -u
old_pid="$PID.oldbin"
cd $APP_ROOT || exit 1
sig () {
test -s "$PID" && kill -$1 `cat $PID`
}
oldsig () {
test -s $old_pid && kill -$1 `cat $old_pid`
}
case $action in
start)
sig 0 && echo >&2 "Already running" && exit 0
su -c "$CMD" - $AS_USER
;;
stop)
sig QUIT && exit 0
echo >&2 "Not running"
;;
force-stop)
sig TERM && exit 0
echo >&2 "Not running"
;;
restart|reload)
sig USR2 && echo reloaded OK && exit 0
echo >&2 "Couldn't reload, starting '$CMD' instead"
su -c "$CMD" - $AS_USER
;;
upgrade)
if sig USR2 && sleep 2 && sig 0 && oldsig QUIT
then
n=$TIMEOUT
while test -s $old_pid && test $n -ge 0
do
printf '.' && sleep 1 && n=$(( $n - 1 ))
done
echo
if test $n -lt 0 && test -s $old_pid
then
echo >&2 "$old_pid still exists after $TIMEOUT seconds"
exit 1
fi
exit 0
fi
echo >&2 "Couldn't upgrade, starting '$CMD' instead"
su -c "$CMD" - $AS_USER
;;
reopen-logs)
sig USR1
;;
*)
echo >&2 "Usage: $0 <start|stop|restart|upgrade|force-stop|reopen-logs>"
exit 1
;;
esac
日志文件:
I, [2014-03-24T15:25:07.830877 #13704] INFO -- : Refreshing Gem list
SECURITY WARNING: No secret option provided to Rack::Session::Cookie.
This poses a security threat. It is strongly recommended that you
provide a secret to prevent exploits that may be possible from crafted
cookies. This will not be supported in future versions of Rack, and
future versions will even invalidate your existing user cookies.
Called from: /home/deployer/website/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/session/abstract_store.rb:28:in `initialize'.
/home/deployer/website/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require': /home/deployer/website/releases/20140111043133/app/models/document.rb:26: syntax error, unexpected tCONSTANT, expecting keyword_end (SyntaxError)
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:359:in `require_or_load'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:502:in `load_missing_constant'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:192:in `block in const_missing'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:190:in `each'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:190:in `const_missing'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/ext/module.rb:36:in `const_missing'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/inflector/methods.rb:229:in `block in constantize'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/inflector/methods.rb:228:in `each'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/inflector/methods.rb:228:in `constantize'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/inflector/methods.rb:259:in `safe_constantize'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/core_ext/string/inflections.rb:66:in `safe_constantize'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/params_wrapper.rb:152:in `_default_wrap_model'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/params_wrapper.rb:169:in `_set_wrapper_defaults'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/params_wrapper.rb:133:in `inherited'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/abstract_controller/railties/routes_helpers.rb:7:in `block (2 levels) in with'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/railties/paths.rb:7:in `block (2 levels) in with'
from /home/deployer/website/releases/20140111043133/app/controllers/documents_controller.rb:1:in `<top (required)>'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:359:in `require_or_load'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:313:in `depend_on'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:225:in `require_dependency'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/engine.rb:438:in `each'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/engine.rb:438:in `block in eager_load!'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/engine.rb:436:in `each'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/engine.rb:436:in `eager_load!'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `instance_exec'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `run'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `each'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `run_initializers'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/application.rb:136:in `initialize!'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/deployer/website/releases/20140111043133/config/environment.rb:5:in `<top (required)>'
from config.ru:4:in `require'
from config.ru:4:in `block in <main>'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
from config.ru:1:in `new'
from config.ru:1:in `<main>'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn.rb:44:in `eval'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn.rb:44:in `block in builder'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:722:in `call'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:722:in `build_app!'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:140:in `start'
from /home/deployer/website/shared/bundle/ruby/1.9.1/gems/unicorn-4.6.2/bin/unicorn:126:in `<top (required)>'
from /home/deployer/website/shared/bundle/ruby/1.9.1/bin/unicorn:23:in `load'
from /home/deployer/website/shared/bundle/ruby/1.9.1/bin/unicorn:23:in `<main>'
document.rb
class Document < ActiveRecord::Base
attr_accessible :description, :filename, :filesize, :filetype, :name, :user_id
belongs_to :user
FILENAME_FORMAT = /^[a-zA-Z0-9_\.]+$/
BAD_FILETYPE_FORMAT = /^Badfiletype$/
MIME_HASH = { "doc" => "application/msword",
"docx" => "application/msword",
"dot" => "application/msword",
"xml" => "application/xml",
"pdf" => "application/pdf",
"tif" => "image/tif",
"txt" => "text/plain",
"xls" => "application/vnd.ms-excel",
"xlsx" => "application/vnd.ms-excel",
"ppt" => "application/vnd.ms-powerpoint",
"pptx" => "application/vnd.ms-powerpoint",
"gif" => "image/gif",
"png" => "image/png",
"jpg" => "image/jpg",
"jpeg" => "image/jpg",
"ps" => "application/postscript",
"rtf" => "application/rtf",
"zip" => "application/zip" }
validates_numericality_of :filesize, less_than: 50M
validates_format_of :filename, with: FILENAME_FORMAT
validates_format_of :filetype, without: BAD_FILETYPE_FORMAT
end
我昨天更改了第26行...
將2048更改為50M
您應該檢查日志中的確切錯誤。 但是,一個簡單的解決方法是終止進程並重新啟動獨角獸。
ps aux | grep unicorn
然后,在其中找到主進程。
kill <process-id>
然后,嘗試再次啟動服務器。
您的腳本在以下行崩潰:
test -s "$PID" && kill -$1 `cat $PID`
$PID
設置在:
PID=/home/deployer/loadmax/shared/pids/unicorn.pid
然后test -s
檢查文件是否存在,並且文件大小大於零。
嘗試刪除此文件,然后再次運行腳本。
至於第26行-嘗試刪除M
它不是數字...-只需輸入50
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.