Forum: Cfengine Help Subject: Daemon Checks Author: nima Link to topic: https://cfengine.com/forum/read.php?3,18350,18350#msg-18350
This has been discussed in a recent thread, however that has not answered my question/problem: Here's the relevant cf3 config: body process_select selectProcess(cmd) { command => "^$(cmd)"; process_result => "command"; } bundle agent RestartDaemon(name, restart_action) { processes: "$(name)" process_select => selectProcess("$(name)"), restart_class => canonify("_dead_daemon") ; commands: "/etc/init.d/$(name)" args => "start", module => "false", ifvarclass => canonify("_dead_daemon") ; "/etc/init.d/$(name)" args => "$(restart_action)", module => "false", ifvarclass => canonify("!_dead_daemon") ; reports: _dead_daemon:: "[ sys-root ]$(ansi.svc)RestartDaemon->commands->start($(name))$(ansi.reset)"; !_dead_daemon:: "[ sys-root ]$(ansi.svc)RestartDaemon->commands->$(restart_action)($(name))$(ansi.reset)"; } The caller config is as follows: bundle agent DNSMasq { classes: "nss_netgroup_dnsmasq" expression => hostinnetgroup("dnsmasq") ; "_newpidfile" and => { fileexists("$(syspath.etc)/hosts"), fileexists("$(syspath.run)/dnsmasq/dnsmasq.pid"), isnewerthan("$(syspath.etc)/hosts", "$(syspath.run)/dnsmasq/dnsmasq.pid") } ; files: nss_netgroup_dnsmasq:: "$(syspath.etc)/dnsmasq.d" copy_from => MirrorFrom("$(config.scm)/etc/dnsmasq.d", "false"), move_obstructions => "true", perms => setRootOwned, depth_search => Recursive, classes => DefineSoftClass("_updated"), comment => "$(ansi.pass)Update($(this.promiser))$(ansi.reset)"; "$(syspath.etc)/dnsmasq.conf" copy_from => MirrorFrom("$(config.scm)/etc/dnsmasq.conf", "true"), move_obstructions => "true", classes => DefineSoftClass("_updated"), comment => "$(ansi.pass)Update($(this.promiser))$(ansi.reset)"; processes: nss_netgroup_dnsmasq:: "dnsmasq" restart_class => "_nopid" ; methods: _nopid|_updated|_newpidfile:: "any" usebundle => RestartDaemon("dnsmasq", "force-reload"); reports: nss_netgroup_dnsmasq:: "[ svc-dnsmasq ]$(ansi.ou)[ ou=dnsmasq ]$(ansi.reset)"; } If I stop the daemon, then it will be started via the "start" argument passed to the init.d script - good. However, if I modify the dnsmasq configuration files, instead of "force-reload", it is still sending it "start". What I need it to do is obvious - "start" if it's not in the process tree, and whatever the use supplied (force-reload in this case) otherwise. Any ideas? _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine