no-re...@cfengine.com wrote: > Forum: Cfengine Help > Subject: Re: cfengine-3; controlling Redhat/CentOS "chkconfig" > Author: neilhwatson > Link to topic: https://cfengine.com/forum/read.php?3,20843,20845#msg-20845 > > vars: > unxxhd01:: > "services" slist => { > "xfs", > "smb", > "autofs", > "xinetd" > > methods: > > redhat|SuSE:: > > "any" usebundle => rh_chkconfig_status(${services}); > } > > bundle agent rh_chkconfig_status(s){ > # Report whether service is enabled using chkconfig > > classes: > > "${s}_enabled" expression => > returnszero("/sbin/chkconfig ${s}","noshell"); > > reports: > > all:: > "${g.pf} Service ${s} is enabled", > ifvarclass => "${s}_enabled"; > > "${g.pk} Service ${s} is not enabled", > ifvarclass => "!${s}_enabled"; > }
Thanks for the various replies, which are mostly similar, but in detail are quite different. In what follows, bear in mind that I'm new to version 3 of cfengine. I understand that there is a "Community Library". Is this "cfengine_stdlib.cf"? I'm using: cfengine-community-3.1.4-1.el5 My stdlib says: # Subversion : $Rev: 61 $ # For Cfengine Core: 3.1.0 It occurs to me that a lot of people use cfengine: 1. to enable/disable services (Redhat/Centos "chkconfig XXX" 2. to start and stop services (Redhat/Centos "service XXX start"). Also there is analogous functionality on other OSes (Solaris-10 "svc" etc.). From that perspective, there is a parallel with package installation and removal. For packages there is already higher-level functionality in "stdlib". Good. But for services no such functionality. That seems poor. Should we consider taking this opportunity to develop in "stdlib" some control of services, perhaps modelled loosely on that for packages? (Or have I missed something obvious?) -- : David Lee : ECMWF (Data Handling System) : Shinfield Park : Reading RG2 9AX : Berkshire : : tel: +44-118-9499 362 : email: david....@ecmwf.int _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine