Class: Lita::Daemon Deprecated

Inherits:
Object
  • Object
show all
Defined in:
lib/lita/daemon.rb

Overview

Deprecated.

Will be removed in Lita 5.0. Use your operating system’s process manager instead.

Converts Lita to a daemon process.

Instance Method Summary collapse

Constructor Details

#initialize(pid_path, log_path, kill_existing) ⇒ Daemon

Returns a new instance of Daemon.

Parameters:

  • pid_path (String)

    The path to the PID file.

  • log_path (String)

    The path to the log file.

  • kill_existing (Boolean)

    Whether or not to kill existing processes.



10
11
12
13
14
# File 'lib/lita/daemon.rb', line 10

def initialize(pid_path, log_path, kill_existing)
  @pid_path = pid_path
  @log_path = log_path
  @kill_existing = kill_existing
end

Instance Method Details

#daemonizevoid

This method returns an undefined value.

Converts Lita to a daemon process.



18
19
20
21
22
23
24
# File 'lib/lita/daemon.rb', line 18

def daemonize
  handle_existing_process
  Process.daemon(true)
  File.open(@pid_path, "w") { |f| f.write(Process.pid) }
  set_up_logs
  at_exit { FileUtils.rm(@pid_path) if File.exist?(@pid_path) }
end