SUMMARY: v5.1+ TruCluster --- Clustercron

From: Parkin Frank - fparki (fparki@acxiom.co.uk)
Date: Wed Apr 02 2003 - 11:02:59 EST


Original Post:

Is there a clustercron type solution for non-root cron's which does not
require a separate CAA script for each user?

Solution:

An elegant solution provided by Jason Orendorf (HP Tru64 Unix Enterprise
Team). Thanks Jason.

Here's one simple method of implementing cluster-wide cron jobs that works
for root and non-root users alike but requires a bit of additional
administrative work for each cron job:
Create a simple script that can only succeed (return 1) on a single member
at any one time. Something like:

                #!/bin/ksh
                set -- $(/usr/sbin/cfsmgr -F raw /)
                shift 12
                [[ "$1" = "$(/bin/hostname -s)" ]] && exit 0
                exit 1

                This script returns TRUE (0) only on the node which is CFS
serving cluster_root. Call it "/bin/cronrun".
Add the cron entry for the new job on *all* nodes, but precede the normal
job with a check for this new script. So if you want to run
"/usr/local/bin/runjob" daily at 5am but only once in the cluster, your new
cron entry on all nodes would be:
5 * * * /bin/cronrun && /usr/local/bin/runjob

This cron entry fires on all nodes, but the check keeps the final job
(runjob in this example) from running on all but one node.
This method nicely mixes with non-clustered cron jobs that are allowed to
run multiple times or will only run on one machine.
The drawbacks to this method are:
All cluster cron jobs that use this will all run on the CFS server for
cluster_root (which could reduce performance if you're running many,
intensive cron jobs.
Administratively, you (and your users) must create the cron entry with the
proper check ("/bin/cronrun && ") for each cluster-ized cron job.
When new members are added to the cluster, the cluster-ized cron entries
created are not propagated to the new node.

Regards
Frank

UNIX System Administrator
Acxiom

**********************************************************************
The information contained in this communication is
confidential, is intended only for the use of the recipient
named above, and may be legally privileged.
If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination,
distribution, or copying of this communication is strictly
prohibited.
If you have received this communication in error,
please re-send this communication to the sender and
delete the original message or any copy of it from your
computer system. Thank You.



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:49:14 EDT