Forum: CFEngine Help
Subject: Re: Process matching by start time
Author: [email protected]
Link to topic: https://cfengine.com/forum/read.php?3,25522,25698#msg-25698
The problem you're seeing here is in process_result. Its inconsistant at best,
misleading at worst.
You're using stime_range. Thats not valid for process_result. Use stime.
process_result => "commands.stime"
Not very intuitive seeing how the variable is called stime_range in one place,
but then has to be refered as stime in another. Here it is working.
# /var/cfengine/bin/cf-agent -I -K -b cfengine_automated_execution
>> Using command line specified bundlesequence
!! Matched: root 14379 12257 12255 0.0 0.0 9220 19 1076 1 Apr24
00:00:00 sh -c /var/cfengine/bin/cf-agent -f failsafe.cf &&
/var/cfengine/bin/cf-agent
!! Matched: root 14536 14379 12255 0.0 0.0 34800 19 3240 1 Apr24
00:00:00 /var/cfengine/bin/cf-agent
-> Signalled 'kill' (9) to process 14536 (root 14536 14379 12255 0.0 0.0
34800 19 3240 1 Apr24 00:00:00 /var/cfengine/bin/cf-agent)
-> Signalled 'kill' (9) to process 14379 (root 14379 12257 12255 0.0 0.0
9220 19 1076 1 Apr24 00:00:00 sh -c /var/cfengine/bin/cf-agent -f
failsafe.cf && /var/cfengine/bin/cf-agent)
-> Filesystem /var's content seems to be sensible as promised
-> Filesystem /'s content seems to be sensible as promised
R: cf3: Cfengine killed a hanging cf-agent process. Please invesitage ASAP why
cf-agent is hanging.
>From the policy itself
processes:
linux|sunos_5_10::
"cf-agent"
handle =>
"verify_cf_agent_doesnt_pile_up",
process_select => cfagent_cruft,
signals => {"kill"},
classes =>
if_repaired("crufty_cfagent_killed");
####################################################################################
body process_select cfagent_cruft
{
command => ".*cf-agent$";
# argments for the ago function
# arg1 : Years, in the range 0,1000
# arg2 : Months, in the range 0,1000
# arg3 : Days, in the range 0,1000
# arg4 : Hours, in the range 0,1000
# arg5 : Minutes, in the range 0,1000
# arg6 : Seconds, in the range 0,40000
# Kill any cf-agent process thats been lingering around, but stop from
-2 hours ago so we dont kill our current execution.
stime_range =>
irange(ago(1,0,0,0,0,0),ago(0,0,0,2,0,0));
process_result => "command.stime";
}
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine