Forum: Cfengine Help
Subject: how do you restart a process only after .conf update?
Author: Sal
Link to topic: https://cfengine.com/forum/read.php?3,19969,19969#msg-19969

We manage changes to several .conf files via cfengine and want to restart the 
daemon only after each new .conf file is pushed but my current logic seems to 
restart the daemon each time cfengine runs.

My syntax within the bundle is:

files:

        any.!ntp_servers::
                "$(ntp_conf_dest)"
                        perms => system("644"),
                        copy_from => 
mycopy("$(master_etc)/ntp/$(ntp_conf_source)","$(p_server)"),
                        action => immediate;

processes:

        "$(ntp_conf_dest)" restart_class => "start_ntpd";

commands:

        start_ntpd::

                "/etc/init.d/ntpd restart";

Since cf-execd is set to run every 20 minutes, ntpd gets restarted every 20 
minutes. What am I missing? It looks like the logic is now that if the file 
$(ntp_conf_dest) exists then restart ntpd. I was hoping this method would only 
run when the file was transferred. Should I not be using restart_class? Should 
I instead use some logic that checks for a change in the .conf file and that 
triggers the restart?

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

Reply via email to