Class PhusionPassenger::Standalone::StartCommand |
In: | lib/phusion_passenger/standalone/start_command.rb
Parent: | Command

Methods

- description
- new
- run

Public Class methods
description()

[ show source ]

        # File lib/phusion_passenger/standalone/start_command.rb, line 42
    42:         def self.description
    43:                 return "Start Phusion Passenger Standalone."
    44:         end

new(args)

[ show source ]

        # File lib/phusion_passenger/standalone/start_command.rb, line 46
    46:         def initialize(args)
    47:                 super(args)
    48:                 @console_mutex = Mutex.new
    49:                 @termination_pipe = IO.pipe
    50:                 @threads = []
    51:                 @interruptable_threads = []
    52:                 @plugin = PhusionPassenger::Plugin.new('standalone/start_command', self, @options)
    53:         end

Public Instance methods
run()

[ show source ]

         # File lib/phusion_passenger/standalone/start_command.rb, line 55
     55:         def run
     56:                 parse_my_options
     57:                 sanity_check_options
     58:
     59:                 ensure_nginx_installed
     60:                 require_file_tail if should_watch_logs?
     61:                 determine_various_resource_locations
     62:                 require_app_finder
     63:                 @app_finder = AppFinder.new(@args, @options)
     64:                 @apps = @app_finder.scan
     65:                 @plugin.call_hook(:found_apps, @apps)
     66:
     67:                 extra_controller_options = {}
     68:                 @plugin.call_hook(:before_creating_nginx_controller, extra_controller_options)
     69:                 create_nginx_controller(extra_controller_options)
     70:
     71:                 begin
     72:                         start_nginx
     73:                         show_intro_message
     74:                         daemonize if @options[:daemonize]
     75:                         Thread.abort_on_exception = true
     76:                         @plugin.call_hook(:nginx_started, @nginx)
     77:                         ########################
     78:                         ########################
     79:                         watch_log_files_in_background if should_watch_logs?
     80:                         wait_until_nginx_has_exited
     81:                 rescue Interrupt
     82:                         stop_threads
     83:                         stop_nginx
     84:                         exit 2
     85:                 rescue SignalException => signal
     86:                         stop_threads
     87:                         stop_nginx
     88:                         if signal.message == 'SIGINT' || signal.message == 'SIGTERM'
     89:                                 exit 2
     90:                         else
     91:                                 raise
     92:                         end
     93:                 rescue Exception => e
     94:                         stop_threads
     95:                         stop_nginx
     96:                         raise
     97:                 ensure
     98:                         stop_threads
     99:                 end
    100:         ensure
    101:                 if @config_filename
    102:                         File.unlink(@config_filename) rescue nil
    103:                 end
    104:                 @plugin.call_hook(:cleanup)
    105:         end