|
From: | Jerry Christopher |
Subject: | Re: Run Once |
Date: | Fri, 28 Feb 2003 15:09:35 -0800 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 |
-- Jerry Christopher AMCC Brian Youngstrom wrote: * Pur A. Lux <puralux@yahoo.com> [030212 10:06]:
What techniques have people used to do this within cfengine?
Here is what I currently use: ----- classes: HasSYSSTAT = ( FileExists(/usr/bin/sar) ) HasUP2DATE = ( FileExists(/usr/sbin/up2date) ) [...] shellcommands: redhat.!HasSYSSTAT:: "/bin/rpm -U http://hagrid/rpms/sysstat-4.0.5-1.i386.rpm" useshell=false timeout=60 HasUP2DATE:: '/bin/rpm -e up2date' useshell=false timeout=10 ----- The FileExists checks look for a file that is included in a particuar package that I care to watch for. Then I either install or remove the package depending on which package is present. I have a script that checks for updates daily, so I don't check for a version specific file here. I just have to remember to update the rpm -i line when I have a new rpm. :) One could use a module to define classes for each rpm installed, then have appropriate shellcommands to install/remove as you wish.-- Brian Youngstrom byoung@cs.washington.edu University of Washington Computer Science & Engineering
Jamie Wilkinson wrote:
This one time, at band camp, Nathan Hubbard wrote:So, does anyone know of the easiest way to guarantee a task will run once? I'm looking to make sure every machine runs a command one time...it doesn't matter when, just that it does it once. Any ideas?You need to set some flag to indicate that the command has been run, and test for it. For example, on my Red Hat boxes, I need to run chkconfig only if the service hasn't already been enabled (or disabled, depending) on some systems. So I do some funky stuff in shellcommands to do the test and set a class, and then if the class is defined run chkconfig to turn on or off the service.
[Prev in Thread] | Current Thread | [Next in Thread] |