Reference:  
http://www.cfengine.org/manuals/cf3-reference.html#restart_005fclass-in-processes

Example - ntpd is down, cf-agent should start it.  It does not.

[r...@localhost inputs]# /etc/init.d/ntpd status
ntpd is stopped
[r...@localhost inputs]# ps auwx|grep ntpd
root     11788  0.0  0.0   3996   684 pts/0    R+   23:26   0:00 grep ntpd
[r...@localhost inputs]# cat example1_service_running_ntpd.cf
body common control

{
bundlesequence  => { "check_ntpd_running"  };
}


bundle agent check_ntpd_running {


   processes:

           "ntpd"

               restart_class => "start_ntpd";

   commands:

       start_ntpd::

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

}
[r...@localhost inputs]# cf-agent -f ./example1_service_running_ntpd.cf
[r...@localhost inputs]# Wed Sep  8 23:26:51 2010:Lock removed
normally 
:pid=11805:lock.check_ntpd_running.processes.restart_class..proc_ntpd_start_ntpd_2679_MD5=56cd7091cb7b8906d0171aa0b2c846a9:
Wed Sep  8 23:26:49 2010 -> Wed Sep  8 23:26:51 2010: Outcome of
version (not specified) (agent-0): Promises observed to be kept 100%,
Promises repaired 0%, Promises not repaired 0%

[r...@localhost inputs]# /etc/init.d/ntpd status
ntpd is stopped
[r...@localhost inputs]#

No, I suspect it's something to do with the regex check, because if I
change the string to

           "nosuchstringatalliamversure"

then it works, ntpd is started.

This is with cfengine 3.0.5p1 community edition.

Thanks,
-at

P.S.  I changed the example from cfservd to ntpd as I don't have
cfservd on my system.
P.P.S. cf-agent -v shows:

cf3 Observe process table with /bin/ps auxw
cf3  XX Nothing promised here [lock.check_ntpd_running.proces] (0/1
minutes elapsed)
cf3
_______________________________________________
Bug-cfengine mailing list
Bug-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/bug-cfengine

Reply via email to