class DanarchyDeploy::Services::Init::Openrc
Public Class Methods
new(service, options)
click to toggle source
# File lib/danarchy_deploy/services/init/openrc.rb, line 6 def initialize(service, options) @service = service @options = options end
Public Instance Methods
disable()
click to toggle source
# File lib/danarchy_deploy/services/init/openrc.rb, line 65 def disable cmd = "rc-update del #{@service} default" DanarchyDeploy::Helpers.run_command(cmd, @options) end
enable()
click to toggle source
# File lib/danarchy_deploy/services/init/openrc.rb, line 60 def enable cmd = "rc-update add #{@service} default" DanarchyDeploy::Helpers.run_command(cmd, @options) end
reload()
click to toggle source
# File lib/danarchy_deploy/services/init/openrc.rb, line 39 def reload status = self.status cmd = if status[:stderr] # status[:stdout].include?('running') # This used to check for status "running"; and previously "started". # Too specific so I've disabled it since I don't remember what this exception was for, originally. puts " |! Service: #{@service} is not running. Starting it up instead." "rc-service #{@service} start" else "rc-service #{@service} reload" end DanarchyDeploy::Helpers.run_command(cmd, @options) end
restart()
click to toggle source
# File lib/danarchy_deploy/services/init/openrc.rb, line 55 def restart cmd = "rc-service #{@service} restart" DanarchyDeploy::Helpers.run_command(cmd, @options) end
start()
click to toggle source
# File lib/danarchy_deploy/services/init/openrc.rb, line 17 def start cmd = "rc-service #{@service} start" status = self.status if status[:stdout].include?('started') return status else DanarchyDeploy::Helpers.run_command(cmd, @options) end end
status()
click to toggle source
# File lib/danarchy_deploy/services/init/openrc.rb, line 11 def status cmd = "rc-service #{@service} status" return { stdout: "Fake run: started", stderr: nil } if @options[:pretend] DanarchyDeploy::Helpers.run_command(cmd, @options) end
stop()
click to toggle source
# File lib/danarchy_deploy/services/init/openrc.rb, line 28 def stop cmd = "rc-service #{@service} stop" status = self.status if status[:stdout].include?('stopped') return status else DanarchyDeploy::Helpers.run_command(cmd, @options) end end