Module: DevDNSd::System

Extended by:
ActiveSupport::Concern
Included in:
Application
Defined in:
lib/devdnsd/system.rb

Overview

System management methods.

Instance Method Summary collapse

Instance Method Details

#action_restartBoolean

Restarts the server in background.

Returns:

  • (Boolean)

    true if action succeeded, false otherwise.



74
75
76
77
78
# File 'lib/devdnsd/system.rb', line 74

def action_restart
  action_stop
  action_start
  true
end

#action_startBoolean

Starts the server in background.

Returns:

  • (Boolean)

    true if action succeeded, false otherwise.



54
55
56
57
58
59
60
61
# File 'lib/devdnsd/system.rb', line 54

def action_start
  logger.info(i18n.starting)

  prepare_start

  @config.foreground ? perform_server : self.class.start
  true
end

#action_statusBoolean

Shows the status of the server

Returns:

  • (Boolean)

    true if action succeeded, false otherwise.



83
84
85
86
87
88
# File 'lib/devdnsd/system.rb', line 83

def action_status
  status = self.class.status
  status = :crashed if status == :unknown && self.class.crashed?

  log_status(self.class.controller.pid, status)
end

#action_stopBoolean

Stops the server in background.

Returns:

  • (Boolean)

    true if action succeeded, false otherwise.



66
67
68
69
# File 'lib/devdnsd/system.rb', line 66

def action_stop
  self.class.stop
  true
end

#daemon_nameString Also known as: name

Returns the name of the daemon.

Returns:

  • (String)

    The name of the daemon.



16
17
18
# File 'lib/devdnsd/system.rb', line 16

def daemon_name
  config ? File.basename(config.pid_file, ".pid") : "devdnsd"
end

#log_directoryString

Returns the standard location of the log file.

Returns:

  • (String)

    The standard location of the log file.



47
48
49
# File 'lib/devdnsd/system.rb', line 47

def log_directory
  File.dirname(config.log_file)
end

#log_file_pathString

Returns the complete path of the log file.

Returns:

  • (String)

    The complete path of the log file.



40
41
42
# File 'lib/devdnsd/system.rb', line 40

def log_file_path
  config.log_file
end

#process_file_pathString

Returns the complete path of the PID file.

Returns:

  • (String)

    The complete path of the PID file.



33
34
35
# File 'lib/devdnsd/system.rb', line 33

def process_file_path
  config ? config.pid_file : Dir.pwd + "devdnsd.pid"
end

#working_directoryString Also known as: runtime_directory

Returns the standard location of the PID file.

Returns:

  • (String)

    The standard location of the PID file.



25
26
27
# File 'lib/devdnsd/system.rb', line 25

def working_directory
  config ? File.dirname(config.pid_file) : Dir.pwd
end