I think you will find that a simple wrapper which checks to see if the node has some token, such as it currently owns the HA-Oracle group, before running the cron job is easier to implement and manage.
cron isn't a very smart service, and it will not react well to a file without an owner in the crontabs directory. Sure, cron could be modified, but a wrapper script is still easier and can be implemented without changing cron at all. You might also look for another job scheduler which is more modern and can be more readily adopted to the task and is easier to implement as an HA service. I've not looked at these for many years, but they are out there. -- richard Lalith Suresh wrote: > Hi everyone, > > I'm thinking of working on HA-Cron and I propose to develop the agent > using the GDS template. Here's the plan I have in mind: > > When a failover happens and the crontab service is to be started on a > new machine: > > 1) Create a backup of the old crontab file with the name 'crontab.old'. > 2) Create the new crontab file to be used by copying the old one. > 3) Add the new cron jobs to the new crontab file. > > There are two possible approaches that we could follow to keep a > record of the cron jobs to be added to the new crontab: > > Sample scenario: > > CU has 2 services configured - netbackup and oracle. > They need to have some cron jobs running for each service. > For the netbackup service, they need to run a cron job for root user > and one for netbkp user. > For the oracle serivice, they need to run cron job for root and oracle > user. > > To handle this situation, we could follow either of two methods: > > 1) Method 1: > > /var/spool/cron/crontabs would have files with names > <user>.<service_name>. > For the netbackup service, there would be 2 files - root.netbackup and > netbkp.netbackup > For the oracle serivcice, there would be - root.oracle and oracle.oracle > Each of the services (RGs) netbackp and oracle would have a HA-Cron > resource. > The specific HA-Cron resource would take care of making just its > <user>.<service> files HA. When HA-Cron comes online, it would copy > over the contents of these files to the respective <user> file on the > node on which the service is running, and delete them from all the > node(s) which do not host this service. > > 2) Method 2: > > We could have a single configuration file where the cron jobs for each > service are listed and separated in the following format: > > # Service: Oracle > <cron job 1> > > # Service: Netbackup > <cron job 1> > <cron job 2> > > We then simply parse the file, and add the jobs to the crontab file > depending on which services are required in the RG being started. > > The stop function can delete the new crontab file and replace it with > the initial backup. > > For probing the crontab service, we could probably set demo tasks for > the cron (like creating temp files with time stamps or updating a > variable or a file etc) to check if cron is working well. > > Please give me some feedback. > > Thanks and regards, > > -- > Lalith Suresh > Department of Computer Engineering > Malaviya National Institute of Technology, Jaipur > +91-9982190365 , lalithsuresh.wordpress.com > <http://lalithsuresh.wordpress.com> > ------------------------------------------------------------------------ > > _______________________________________________ > ha-clusters-discuss mailing list > ha-clusters-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/ha-clusters-discuss >