Sha256: f3f5f00c94fb12f3d5469a26705f82aea9f584f44efde3c401bb5286e27fe99c
Contents?: true
Size: 1.23 KB
Versions: 11
Compression:
Stored size: 1.23 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 def show raise NotImplementedError end end end
Version data entries
11 entries across 11 versions & 1 rubygems