Sha256: 9276ff8cef854592308495e1dd6773fcce9b0abc3b3cc596e6a84b0731a04e78
Contents?: true
Size: 1002 Bytes
Versions: 1
Compression:
Stored size: 1002 Bytes
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 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
linux_admin-0.15.0 | lib/linux_admin/service/sys_v_init_service.rb |