lib/linux_admin/service.rb in linux_admin-0.1.3 vs lib/linux_admin/service.rb in linux_admin-0.2.0

- old
+ new

@@ -11,42 +11,40 @@ @id = id end def running? run(cmd(:service), - :params => { nil => [id, "status"] }, - :return_exitstatus => true) == 0 + :params => { nil => [id, "status"] }).exit_status == 0 end def enable - run(cmd(:systemctl), + run!(cmd(:systemctl), :params => { nil => ["enable", "#{id}.service"] }) self end def disable - run(cmd(:systemctl), + run!(cmd(:systemctl), :params => { nil => ["disable", "#{id}.service"] }) self end def start - run(cmd(:service), + run!(cmd(:service), :params => { nil => [id, "start"] }) self end def stop - run(cmd(:service), + run!(cmd(:service), :params => { nil => [id, "stop"] }) self end def restart status = run(cmd(:service), - :params => { nil => [id, "restart"] }, - :return_exitstatus => true) + :params => { nil => [id, "restart"] }).exit_status # attempt to manually stop/start if restart fails if status != 0 self.stop self.start