Forum: CFEngine Help
Subject: Re: Define classes if a process is running or not
Author: sauer
Link to topic: https://cfengine.com/forum/read.php?3,26838,26853#msg-26853

One problem with using two classes is that, if you define two separate classes, 
you need to have an action body which not only raises one class but lowers the 
other at the same time.  Consider the situation where the process is running on 
the first pass through the promises, but has stopped on the second pass (or 
vice-versa).  Then you'll have both the running and stopped classes, unless you 
lower one when raising the other.

Ignoring that, you could simply abuse the restart class, and do something like 
this:
processes:

"$(process_name)"
  action => if_ok( "process_up" ),
  restart_class => "process_down";



I'd still probably write my own version of if_else that also lowers one when it 
raises the other class, though.

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to