Let wmde_servcie work with onestart/onestop ... instead of start/stop
This commit is contained in:
parent
d5f1f7f8a0
commit
ecaceffca7
26
lib.cf
26
lib.cf
|
@ -107,13 +107,35 @@ body service_method wmde
|
||||||
|
|
||||||
bundle agent wmde_service(service_name,start_cond, restart_cond)
|
bundle agent wmde_service(service_name,start_cond, restart_cond)
|
||||||
{
|
{
|
||||||
|
classes:
|
||||||
|
freebsd::
|
||||||
|
"service_running" expression => returnszero("/usr/sbin/service $(service_name) onestatus >/dev/null 2>&1", "useshell");
|
||||||
|
|
||||||
|
commands:
|
||||||
|
|
||||||
|
"freebsd&(!service_running)&($(start_cond))"::
|
||||||
|
"/usr/sbin/service"
|
||||||
|
args => "$(service_name) onestart >/dev/null 2>&1",
|
||||||
|
contain => wmde_cmd_useshell,
|
||||||
|
handle => "$(handle)_service_started";
|
||||||
|
"freebsd&(service_running)&($(start_cond))"::
|
||||||
|
"/usr/bin/true"
|
||||||
|
inform => "false",
|
||||||
|
handle => "$(handle)_service_started";
|
||||||
|
|
||||||
|
"freebsd&($(restart_cond))"::
|
||||||
|
"/usr/sbin/service"
|
||||||
|
args => "$(service_name) onerestart >/dev/null 2>&1",
|
||||||
|
contain => wmde_cmd_useshell,
|
||||||
|
handle => "$(handle)_service_restarted";
|
||||||
|
|
||||||
services:
|
services:
|
||||||
"$(start_cond)"::
|
"(!freebsd)&($(start_cond))"::
|
||||||
"$(service_name)"
|
"$(service_name)"
|
||||||
service_policy => "start",
|
service_policy => "start",
|
||||||
handle => "$(handle)_service_started";
|
handle => "$(handle)_service_started";
|
||||||
|
|
||||||
"$(restart_cond)"::
|
"(!freebsd)&($(restart_cond))"::
|
||||||
"$(service_name)"
|
"$(service_name)"
|
||||||
service_policy => "restart",
|
service_policy => "restart",
|
||||||
handle => "$(handle)_service_restarted";
|
handle => "$(handle)_service_restarted";
|
||||||
|
|
Loading…
Reference in New Issue