Forum: Cfengine Help
Subject: Re: cfengine-3; controlling Redhat/CentOS "chkconfig"
Author: Authority
Link to topic: https://cfengine.com/forum/read.php?3,20843,20847#msg-20847

Personally I use a combination of classes promises, fileexists to test for the 
existence of the resultant symlinks of enabling a service, and commands 
promises for those classes I just set.

    classes:
        redhat.server::
            "cf_serverd_enabled"
                comment => "Check that cf-serverd is enabled in normal run 
level." ,
                expression => fileexists("/etc/rc.d/rc3.d/S60cf-serverd");

            "cf_monitord_enabled"
                comment => "Check that cf-monitord is enabled in normal run 
level." ,
                expression => fileexists("/etc/rc.d/rc3.d/S60cf-monitord");

            "cf_execd_enabled"
                comment => "Check that cf-execd is enabled in normal run 
level." ,
                expression => fileexists("/etc/rc.d/rc3.d/S60cf-execd");

    commands:
        redhat.cf_execd_enabled::
            "/sbin/chkconfig cf-execd off" ,
                comment => "Disable the Cfengine Executor daemon on boot.";
            
        redhat.cf_monitord_enabled::
            "/sbin/chkconfig cf-monitord off" ,
                comment => "Disable the Cfengine Monitoring daemon on boot.";
            
        redhat.!cf_serverd_enabled::
            "/sbin/chkconfig cf-serverd on" ,
                comment => "Start the Cfengine Server daemon on boot.";

Although I just saw Neil's classes examples and think that his test for whether 
it's enabled is better than mine.  I didn't know about the simple "chkconfig " 
syntax.

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

Reply via email to