Forum: Cfengine Help
Subject: Re: Redhat / Fedora / CentOS processes, services, and chkconfig nirvana
Author: bbomgardner
Link to topic: https://cfengine.com/forum/read.php?3,21202,21285#msg-21285
Here is what I came up with to deal with chkconfig. It seems to work OK. Any
ideas for improvement would be welcome...
Mike, I think you were having problems because the ! was inside of the canonify
function, but I could have misunderstood what you were trying.
bundle agent service_startup(s,state)
{
vars:
"service" string => canonify("$(s)");
classes:
redhat::
"$(service)_enabled" expression => returnszero("/sbin/chkconfig
$(s)", "noshell");
SuSE::
"$(service)_enabled" expression => returnszero("/sbin/chkconfig -c
$(s)", "noshell");
any::
"please_enable_$(service)" expression =>
regcmp("(on|start|enable)","$(state)");
"please_disable_$(service)" expression =>
regcmp("(off|stop|disable)","$(state)");
commands:
"/sbin/chkconfig $(s) on"
comment => "Enable service $(s) using chkconfig.",
ifvarclass => "!$(service)_enabled&please_enable_$(service)";
"/sbin/chkconfig $(s) off"
comment => "Disable service $(s) using chkconfig.",
ifvarclass => "$(service)_enabled&please_disable_$(service)";
}
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine