On Wed, Mar 17, 2010 at 11:30:55AM -0400, Matt Richards wrote:
>Good idea. I find the process overcounting more common. In my configuration, I
>have a range for the process count and it reports when the process count is
>out of range. I will add a "ps -ef" along with the report. It may not catch it
>as it is not run exactly as the same time as the cf process count, but it
>might be close enough to catch it.
>
>The process I am watching for can only have one process running. I intended it
>to flag if not running, but it actually flags for two processes running (which
>can't be possible, unless some odd regex is catching another process).
I've a similar situation--I want to ensure that one, and only one
process is running. I came up with this, but it doens't work:
bundle agent check_proc {
vars:
"MyProc_processes" slist => { "MyProc","MyProc_variant" };
processes:
run_proc::
"/path/to/MyProc"
handle => "find_MyProc_procs",
restart_class => 'start_process',
process_count => check_range("MyProc_single","1","1"),
process_select => find_MyProc;
# Different name to distinguish from the previous
# promise
"[ /]MyProc"
handle => "too_many_MyProc_procs",
process_count => MyProc_too_many;
commands:
MyProc_too_many::
"/usr/bin/pkill"
handle => 'kill_MyProc',
contain => quiet_no_shell,
classes =>
if_else('start_MyProc','bogus_MyProc_processes'),
args => "${MyProc_processes}";
(start_MyProc|MyProc_zero_processes)::
"/etc/rc.d/init.d/MyProc start";
}
body process_select find_MyProc {
process_owner => { 'someuser' };
process_result => "process_owner";
}
body process_count sge_too_many {
match_range => irange('2','99999');
in_range_define => { 'MyProc_too_many' };
}
--
Jesse Becker
NHGRI Linux support (Digicon Contractor)
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine