On 25/04/2012 17:51, Nick Anderson wrote:
> On 04/25/2012 10:16 AM, [email protected] wrote:
>> Ok, now I get what you mean. Without the restart_class, the promise is 'kept'
>> even if the process isn't running. otoh, we don't really promise anything if
>> there's no restart_class.. might be the reason it's seen as kept. But this
>> was
>> news to me. Thanks :)
> I guess it would be handy to know what the promise is.
>
> When I read it I think. "I promise to do these things if I see a process
> matching proc." With the restart_class present I think, "raise this
> class if no processes match" which I considered equivalent to classes
> => if_notkept("proc_not_running");
>
> Thats probably not correct. Probably more correct to think of the entire
> thing as the promise. And then it seems like the classes attribute isn't
> a "first class citizen". So its not activated unless one of the primary
> attributes signals the promises state change. Now im confused again :)
>
> As Neil suggested, I think some additional clarification around promise
> state behavior for each promise type would be good. And perhaps someone
> can chime in here for some more clarification.
>
What I use to know if a process is running is the simple body from the
cfengine_stdlib :
body process_count any_count(cl)
{
match_range => "0,0";
out_of_range_define => { "$(cl)" };
}
Which can be used in your example as :
"proc"
process_count => any_count("proc_is_running"),
comment => "Check if proc is running";
But I'm not sure it's really what you need, and I'm afraid I'm
oversimplifying your question
Regards
Nicolas
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine