> Christopher Browne wrote: >>> Can cfengine do this? Nicelly, easy and without hacks please! >>> >>> We need to schedule a script to run on ONLY ONE of the N hosts. >>> The catch is that any host could be down at any moment in the future, >>> so schedulling cronjob on one of the hosts is not a reliable option. >>> Also the job cannot be run more that once (ie cannot be run from >>> multiple hosts). >> >> This isn't the sort of thing that cfengine is designed to provide >> answers for. >> >> What you actually need is some sort of central authority; part of the >> point of cfengine is to not have that vulnerability. >> >> If I had a database server around, I'd be inclined to use it to manage >> this sort of "locking" problem. >> >> All N hosts would *attempt* to run the cron job; they start by telling >> the DB server "I am the only one that will be running this process." >> Only one would succeed (let's say they all try to insert the desired >> time and job name into a table with unique index on time/job); the >> "winner" gets to continue and run the job. > > Simplisticly, that could probably be done by creating (lock) files. The > cfengine host that creates the file first wins. Of course, this assumes an > NFS setup and, thus, that is the vulnerability in the scheme.
I suggested the database as a mechanism because: a) You probably have one around if you have so many servers :-) b) Databases tend to have well-implemented locking mechanisms. Come to think of it, cfengine uses Sleepycat DB, which has a lock management subsystem. <http://www.sleepycat.com/docs/ref/lock/intro.html> -- output = ("cbbrowne" "@" "gmail.com") http://linuxdatabases.info/info/slony.html Rules of the Evil Overlord #225. "I will explain to my guards that most people have their eyes in the front of their heads and thus while searching for someone it makes little sense to draw a weapon and slowly back down the hallway." <http://www.eviloverlord.com/> _______________________________________________ Help-cfengine mailing list Help-cfengine@gnu.org http://lists.gnu.org/mailman/listinfo/help-cfengine