Sha256: 7a531d40801ae5e979ad7e02102047e945c9d86ba3df9a8c04cf7fce45e8e951
Contents?: true
Size: 1007 Bytes
Versions: 1
Compression:
Stored size: 1007 Bytes
Contents
module LinuxAdmin class SystemdService < Service def running? Common.run(Common.cmd(:systemctl), :params => {nil => ["status", name]}).exit_status == 0 end def enable Common.run!(Common.cmd(:systemctl), :params => {nil => ["enable", name]}) self end def disable Common.run!(Common.cmd(:systemctl), :params => {nil => ["disable", name]}) self end def start Common.run!(Common.cmd(:systemctl), :params => {nil => ["start", name]}) self end def stop Common.run!(Common.cmd(:systemctl), :params => {nil => ["stop", name]}) self end def restart status = Common.run(Common.cmd(:systemctl), :params => {nil => ["restart", name]}).exit_status # attempt to manually stop/start if restart fails if status != 0 stop 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/systemd_service.rb |