lib/thin/daemonizing.rb
# Turns the current script into a daemon process that detaches from the console.
Turns the current script into a daemon process that detaches from the console.
Turns the current script into a daemon process that detaches from the console .
def daemonize
      raise PlatformNotSupported, 'Daemonizing is not supported on Windows'     if Thin.win?
      raise ArgumentError,        'You must specify a pid_file to daemonize' unless @pid_file
      remove_stale_pid_file
      pwd = Dir.pwd 
      Daemonize.daemonize(File.expand_path(@log_file), name)
      Dir.chdir(pwd)
      write_pid_file
      trap('HUP') { restart }
      at_exit do
        log ">> Exiting!"
        remove_pid_file
      end
    end
def daemonize raise PlatformNotSupported , 'Daemonizing is not supported on Windows' if Thin . win? raise ArgumentError , 'You must specify a pid_file to daemonize' unless @pid_file remove_stale_pid_file pwd = Dir . pwd Daemonize . daemonize ( File . expand_path ( @log_file ) , name ) Dir . chdir ( pwd ) write_pid_file trap ( 'HUP' ) { restart } at_exit do log ">> Exiting!" remove_pid_file end end
Turns the current script into a daemon process that detaches from the console.
Turns the current script into a daemon process that detaches from the console .
# Current directory is changed during daemonization, so store it