Search code examples
ruby-on-railspassenger

How to kill the demonized fusion passenger rails app


Using daemonize option, I execute the rails app with phusion passenger as a daemon.

bundle exec passenger start --port 8000 --user ubuntu --daemonize

How to kill the daemonized app?

I have four processes running, but I think there might be a better way to kill all the processes to stop the daemon.

enter image description here


Solution

  • Killing only the master process automatically kills all the other processes.

    From the screen capture, kill -9 5702 will kill all the running processes. Even with passenger, the passenger.IP.pid file contains the pid so that you can use to kill the process.

    With passenger-status or passenger-memory-status, I can get the id so that I can kill the process.

    ubuntu@ip-172-31-63-19 public> sudo passenger-status
    Version : 5.0.21
    Date    : 2015-11-06 05:54:30 +0000
    Instance: GbUcQO1V (nginx/1.8.0 Phusion_Passenger/5.0.21)
    
    ----------- General information -----------
    Max pool size : 1
    App groups    : 1
    Processes     : 1
    Requests in top-level queue : 0
    
    ----------- Application groups -----------
    /home/ubuntu/webapp/rails/passenger-ruby-rails-demo/public (development):
      App root: /home/ubuntu/webapp/rails/passenger-ruby-rails-demo
      Requests in queue: 0
      * PID: 3355    Sessions: 0       Processed: 8       Uptime: 4s
        CPU: 10%     Memory  : 61M     Last used: 3s ago