Sha256: 41dea2bca536e82e62e49e458500a3d9fafed8f6b790acafae19ed731646d233
Contents?: true
Size: 1.18 KB
Versions: 4
Compression:
Stored size: 1.18 KB
Contents
module LinuxAdmin class SysVInitService < Service def running? Common.run(Common.cmd(:service), :params => {nil => [name, "status"]}).exit_status == 0 end def enable Common.run!(Common.cmd(:chkconfig), :params => {nil => [name, "on"]}) self end def disable Common.run!(Common.cmd(:chkconfig), :params => {nil => [name, "off"]}) self end def start Common.run!(Common.cmd(:service), :params => {nil => [name, "start"]}) self end def stop Common.run!(Common.cmd(:service), :params => {nil => [name, "stop"]}) self end def restart status = Common.run(Common.cmd(:service), :params => {nil => [name, "restart"]}).exit_status # attempt to manually stop/start if restart fails if status != 0 self.stop self.start end self end def reload Common.run!(Common.cmd(:service), :params => [name, "reload"]) self end def status Common.run(Common.cmd(:service), :params => [name, "status"]).output end end end
Version data entries
4 entries across 4 versions & 1 rubygems