diff --git a/lib.cf b/lib.cf index d787ac4..8014f0d 100644 --- a/lib.cf +++ b/lib.cf @@ -103,15 +103,31 @@ bundle agent wmde_service(service_name,start_cond, restart_cond) services: "$(start_cond)":: "$(service_name)" - service_policy => "start"; + service_policy => "start", + handle => "$(handle)_service_started"; "$(restart_cond)":: "$(service_name)" - service_policy => "restart"; + service_policy => "restart", + handle => "$(handle)_service_restarted"; reports: } +bundle agent wmde_restart_service(service_name, id) +{ +commands: + debian:: + "/bin/sh -c " + args => "'/bin/echo $(id) > /dev/null && /usr/bin/systemctl restart $(service_name)'"; + freebsd:: + "/bin/sh -c " + args => "'/bin/echo $(id) > /dev/null && /usr/sbin/service onerestart $(service_name)'"; +} + + + + body contain wmde_cmd_useshell { useshell=>"useshell";