Forum: Cfengine Help
Subject: Re: command execution
Author: phnakarin
Link to topic: https://cfengine.com/forum/read.php?3,16853,16854#msg-16854

You should simply use body classes if_repaired(), if you include 
cfengine_stdlib.cf to your policy.

#####

body classes if_repaired(x)
{
promise_repaired => { "$(x)" };
}

#####

files:
 any::
  "/etc/ssh/sshd_config"
     
     classes => if_repaired(please_restart_sshd);

commands:
 please_restart_sshd::
  comment => "restart sshd when /etc/ssh/sshd_config is changed",
  "/etc/init.d/sshd restart";

Cheers,
--Nakarin

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to