Forum: CFEngine Help Subject: Re: Using the new services promise types with Linux's chkconfig Author: loopx Link to topic: https://cfengine.com/forum/read.php?3,26785,26844#msg-26844
Hi, I was looking this thread to try to use "services" promises too, but if it doesn't work for Linux (RHEL6), it's useless to try it ^^. So, you can use our old method : use a module. The module "chkconfig" : #!/bin/bash # Description : modules to set additional classes related to services (enabled/disabled) ######################################################################################## for service in $@ ; do servicename=$(echo $service | sed s/-//g ); if chkconfig --list $service 2>/dev/null | grep -q "3:on" ; then echo "+${servicename}_enabled"; echo "-${servicename}_disabled"; else echo "-${servicename}_enabled"; echo "+${servicename}_disabled"; fi done The promise : commands: redhat_6:: "$(g.location_modules)/chkconfig $(services)" module => "true", action => immediate, comment => "Execute this module to set extra-classes ; MUST be run immediately to avoid false-positive!"; rhsmcertd_enabled:: "/sbin/chkconfig rhsmcertd off" action => day, comment => "Disable rhsmcertd to avoid useless warning message in '/var/log/messages'"; It works fine ; to adapt, of course ;) _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine