class Baal::Daemon
Daemon
is a builder object that allows you construct and access, at any time, the start-stop-daemon string that will be executed. All building of the start-stop-daemon string will be through this object.
A note should be made that all methods which build the start-stop-daemon script return the Daemon
instance for the intention of method chaining where possible so as to read like written English.
Constants
- PROGRAM_NAME
Attributes
std_status[R]
stderr[R]
stdout[R]
Public Class Methods
new()
click to toggle source
# File lib/baal.rb, line 40 def initialize @commands_and_opts = [] end
Public Instance Methods
clear_all!()
click to toggle source
Clears @commands_and_opts and starts over with only the PROGRAM_NAME
# File lib/baal.rb, line 48 def clear_all! @commands_and_opts.clear self end
daemonize!()
click to toggle source
Executes the built up start-stop-daemon string and throws an error if there isn't at least one command and at least one matching option.
@return [nil] returns nil to force user to interact with the attr methods
for the system output vs the array that would be returned if nil was not used
# File lib/baal.rb, line 67 def daemonize! at_least_one_command? at_least_one_matching_option? @stdout, @stderr, @std_status = Open3.capture3(PROGRAM_NAME, *@commands_and_opts) nil end
execution()
click to toggle source
@return [String] the built up, whitespace-formatted start-stop-daemon
string to be executed
# File lib/baal.rb, line 56 def execution ([PROGRAM_NAME] + @commands_and_opts).join(' ').strip end