LoginSignup
17
18

More than 5 years have passed since last update.

実行中の Unicorn のバージョンを見るには

Posted at

TL;DR: lsof -p で Unicorn プロセスが開いているファイルを一覧して、 gem のディレクトリのバージョン番号を探せばいい。


まず Unicorn のプロセスを探す。

$ ps aux | grep unicorn
user            41323   0.0  0.0  2442000    628 s000  S+    4:26PM   0:00.00 grep unicorn
user            40631   0.0  0.6  2542788  46724   ??  S     4:14PM   0:00.14 unicorn worker[1] -c uni -D    
user            40630   0.0  0.6  2541764  46404   ??  S     4:14PM   0:00.15 unicorn worker[0] -c uni -D    
user            40629   0.0  0.1  2540740   5336   ??  S     4:14PM   0:00.01 unicorn master -c uni -D

lsof -p を使って、バージョン番号を知りたい Unicorn プロセスが開いているファイルの一覧を表示する。

$ lsof -p 40631
COMMAND   PID USER   FD   TYPE             DEVICE  SIZE/OFF     NODE NAME
ruby    40631 user  cwd    DIR                1,1       612 51962934 /Users/user
ruby    40631 user  txt    REG                1,1   2217260 83107071 /Users/user/.rbenv/versions/2.0.0-p353/bin/ruby
...

長いので grep gems/unicorn- をかける。

$ lsof -p 40631 | grep gems/unicorn-
ruby    40631 user  txt    REG                1,1     42848 84416806 /Users/user/vendor/bundle/ruby/2.0.0/gems/unicorn-4.8.0/lib/unicorn_http.bundle

ディレクトリに含まれるバージョン番号から、この Unicorn プロセスのバージョンが4.8.0であると分かる。

17
18
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
17
18