LoginSignup
31
20

More than 5 years have passed since last update.

Railsを起動でUnicornのpidが原因で起きたエラーの対処法

Last updated at Posted at 2018-10-15

①Rails 起動でエラーになった

AWSでWebアプリケーションを公開した時にハマったエラーについて、備忘録として記します。

railsを
unicorn_rails -c config/unicorn.rb -E production
で起動させてもすぐにコマンドが終了してしまい、起動しませんでした。

②エラーの内容を探る

less log/unicorn.stderr.log
でエラーの内容を見てたところ、

`pid=': Already running on PID:30364 (or pid=/var/
www/xxxxxx/tmp/pids/unicorn.pid is stale) (ArgumentError)

この辺でエラーになっているようです。

③プロセスの確認

grepを使って特定のプロセス(ここでは、unicorn)を確認します

ps aux | grep unicorn
でプロセスを出して、

ec2-user xxxxx

ここのxxxxの番号のどれかのプロセスが不要に残ってしまっていて、悪影響が出ていたようです。

④プロセスの削除

kill -9 xxxx
で、削除ができ、
unicorn_rails -c config/unicorn.rb -E production
もできるようになりました!!!

31
20
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
31
20