I'm working an a bundle for Apache, and specifically the processes:
section.  I have several conditions:

* If httpd not running, start it.

* If httpd not running as root/apache, kill current processes, and start
    the daemon properly.

* If there are "too few" httpd processes (i.e. 1-2), kill them, and
    restart.


As best I can figure, this requires three separate promises, and at
least two more bodies in support.  Am I completely missing a simpler
solution here?

<----snip---->

bundle httpd {

processes:
        Webservers::
          "/usr/sbin/httpd"
              process_count  => httpd_stragglers,
                     signals => { 'term', 'quit', 'kill' },
                     comment => "Kill off stragglers: if only 1 or 3 procs 
present, it's probably broken.";

          "/usr/sbin/httpd"
              process_select => not_apache_user,
                     signals => { 'term', 'quit', 'kill' },
                     comment => "Kill off httpd processes not owned by either 
'root' or 'apache'";

          "/usr/sbin/httpd"
               restart_class => "StartHTTPD",
                     comment => "Start apache if it isn't running";

}


body process_count httpd_stragglers {
      match_range => "1,2";
      in_range_define => { 'httpd_stragglers' };
}

body process_select apache_user {
      process_owner => { 'root', 'www', 'apache' };
      process_result => "process_owner";
}


<----snip---->

-- 
Jesse Becker
NHGRI Linux support (Digicon Contractor)
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to