Sha256: d2dcc3e3c8fc5abeedf0cc8711bbbc4bad225cdd7a2661b2de02fe86a9b13369
Contents?: true
Size: 881 Bytes
Versions: 6
Compression:
Stored size: 881 Bytes
Contents
module LinuxAdmin class SystemdService < Service def running? run(cmd(:systemctl), :params => {nil => ["status", name]}).exit_status == 0 end def enable run!(cmd(:systemctl), :params => {nil => ["enable", name]}) self end def disable run!(cmd(:systemctl), :params => {nil => ["disable", name]}) self end def start run!(cmd(:systemctl), :params => {nil => ["start", name]}) self end def stop run!(cmd(:systemctl), :params => {nil => ["stop", name]}) self end def restart status = run(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
6 entries across 6 versions & 1 rubygems