help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strategy for "one-off" tasks


From: Jamie Wilkinson
Subject: Re: Strategy for "one-off" tasks
Date: Fri, 11 Jul 2003 14:59:14 +1000
User-agent: Mutt/1.5.4i

This one time, at band camp, Ferguson, Steve wrote:
>I'm interested in hearing how people are applying cfengine to perform "one
>off" system management tasks.  It's fairly obvious how one would insert a
>new configuration task in on a recurring basis.  But how would you approach
>a task that you only want to execute one time?  I've got a few different
>ideas in mind, but I'd like to hear what other folks have been doing in
>practice before I commit to any one process.

Rethink your one-off task to instead be a "needs to happen if" task, for
example you need to run chkconfig if a service that should be running isn't
configured.

That way, cfengine will know when it needs to run your one-off task, and so
if you find your system unconverges, cfengine will sort it out for you the
second time too.

Use the shellcommands: section to run a command if you can't use the normal
FileExists and so on to define some class; like so:

shellcommands:

    vsftpd_server::
        "/sbin/chkconfig --list vsftpd | grep off"
                useshell=true
                define=vsftpd_chkconfig
                inform=false

    vsftpd_chkconfig::
        "/sbin/chkconfig vsftpd on"
                useshell=false

The test part gets run everytime, but the one-off task only ever gets called
once (or until someone manually intervenes -- at which point you will need
to run your one-off task again and magically cfengine will take care of it
for you)

-- 
jaq@spacepants.org                           http://spacepants.org/jaq.gpg




reply via email to

[Prev in Thread] Current Thread [Next in Thread]