Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Failing over crontabs in HACMP

Skip to first unread message

stou...@my-dejanews.com

unread,
May 19, 1999, 3:00:00 AM5/19/99
to
I need to move over some crontab entries from one
host to the next when an ha takeover event is
triggered. I have put together a makeshift script
called by the ha start script which read those
entries and puts them in the crontabs of the new
host. But, is there some automated way of doing
this?


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---

Michael Bradshaw

unread,
May 19, 1999, 3:00:00 AM5/19/99
to
In article <7huqee$a73$1...@nnrp1.deja.com>, stou...@my-dejanews.com wrote:

> I need to move over some crontab entries from one
> host to the next when an ha takeover event is
> triggered. I have put together a makeshift script
> called by the ha start script which read those
> entries and puts them in the crontabs of the new
> host. But, is there some automated way of doing
> this?

I'm not sure why you feel this is not automated.

That's the way it works - choose the HACMP events for takeover
and add a pre or post event script to take care of crontab entries, and
AIX will take care to call the scripts each time the events are
triggered...

You can make it as fancy or simple as you please with notification, error
codes, custom events, etc...

mike

bre...@yahoo.com

unread,
May 20, 1999, 3:00:00 AM5/20/99
to
Hi,
The way you do is the right one. There is no buildin feature.
Brenzef


In article <7huqee$a73$1...@nnrp1.deja.com>,
stou...@my-dejanews.com wrote:
> I need to move over some crontab entries from one
> host to the next when an ha takeover event is
> triggered. I have put together a makeshift script
> called by the ha start script which read those
> entries and puts them in the crontabs of the new
> host. But, is there some automated way of doing
> this?
>

John Jaszczak

unread,
Jun 1, 1999, 3:00:00 AM6/1/99
to
I don't quite understand what you are saying, but here is my suggestion for
what it is worth. Copy the crontab(s) from host A to a backup directory on
host B (/var/spool/cron/hacmp.backup?)
When host B does a takeover of host A than have your "ha start script" copy
off the host B crontabs and install the host A crontabs
(as root crontab /var/spool/cron/hacmp.backup/root).

-JAZZ

--
John Jaszczak
Romac International
Assigned to: Harmonic Systems, Inc.
jjas...@harmonic.com
612-321-4139

stou...@my-dejanews.com wrote in message <7huqee$a73$1...@nnrp1.deja.com>...

Dave Hinkle

unread,
Jun 1, 1999, 3:00:00 AM6/1/99
to
I use the following script I've named hacron:

#!/bin/ksh
if [[ -a $1 ]]; then
eval exec $@
fi


Crontab entries look like this
0 0 * * * /usr/local/bin/hacron /ha/file/system/script
">>/ha/file/system/script.out"

I keep the scripts I want to run on a file system resource, and sync the
crontab files on each system. This way, the scripts on get run when the
filesystems move.


John Jaszczak wrote in message <7j0fct$aki$1...@news.mr.net>...

Dave Hinkle

unread,
Jun 1, 1999, 3:00:00 AM6/1/99
to
Attached is the full script with documentation and all:


#!/bin/ksh
#
# $Header: /usr/local/cvsroot/cluster_sw/usr/local/bin/hacron,v 1.2
1998/12/17 17:43:29 dh3235 Exp $
#
# This script is used to allow cron jobs to run in an HACMP environment.
# The problem is, in an HA environment, a file system belonging to an HA
# resource can exist on either machine. Any commands that need to be
executed
# from cron, on that file system, need to be entered in the crontab entries
# for both machines. Only one machine can have the file system mounted, so
# the machine without the file system will log lots of errors from the cron
# system about the command to run being missing.
#
# To solve this problem, use this script to call the scripts that need to be
# cron'd. This script will check to see if the script to run exists, and if
# so, run it. If the file does not exist, this script exits quietly.
#
# To redirect ouput to the same filesystem that the command lives on,
# enclose the redirection parameters in double quotes. Otherwise, cron
# will complain that it cannot create the output file on a non-existant
# file system. See the 2nd example below.
#
# An example of how to use this is as follows:
#
# 0 1 * * * /usr/local/bin/hacron /prod/ecs/edi/bin/ediarc.ksh -b/prod
# 5 1 * * * /usr/local/bin/hacron /prod/ecs/edi/bin/test 1
">>/prod/ecs/edi/log 2>&1"
#
#
# Revision History:
#
# $Log: hacron,v $
# Revision 1.2 1998/12/17 17:43:29 dh3235
# Added an "eval" statement before the exec. This allows the user to
pass
# as the last argument, a double quoted string containing a
redirection
# string. This keeps cron from complaining if the redirection is to a
non
# existant filesystem on the failover machine.
#
# Revision 1.1 1998/12/11 15:38:29 dh3235
# Initial version.
#
#
############################################################################


if [[ -a $1 ]]; then
eval exec $@
fi

#

chris rees

unread,
Jun 7, 1999, 3:00:00 AM6/7/99
to
Hi John,

Below you wrote that you could tailor the HA start script to copy the cron
files into the proper place. However in my situation I would only want these
cron files copied in if a takeover event was happening, NOT if I was just
stopping and starting HA on my secondary node. The question is , how do I tell
HA to copy these cron files into place ONLY if a takeover has taken place.?

Thanks in advance.

Chris Rees

vcard.vcf

John Jaszczak

unread,
Jun 7, 1999, 3:00:00 AM6/7/99
to
Chris,
My level of experience with HACMP was such that I could modify the
existing instalation to suit my needs. Unfortunately, I do not know how to
determine whether a failover is intentional or unintentional.
I do know that the environment where I used to work was a cascading
HA environment. If I was merely starting the secondary server the HACMP
takeover scripts did not get run. If both the primary and the secondary
servers were running and the primary failed then the scripts did get run.
I no longer have access to the HACMP environment or the HACMP manuals. I
learned the majority of what I know about HACMP by reading the manual set. I
am sure, the Admin manual in particular will probably have the answer for
you.
If someone else has a quick and easy answer, please speak up.

-JAZZ


--
John Jaszczak
Romac International
Assigned to: Harmonic Systems, Inc.
jjas...@harmonic.com
612-321-4139

chris rees wrote in message <375B86CE...@uk.ibm.com>...

Tom Weaver

unread,
Jun 7, 1999, 3:00:00 AM6/7/99
to
In article <375B86CE...@uk.ibm.com>,

chris rees <c_r...@uk.ibm.com> wrote:
>The question is , how do I tell
>HA to copy these cron files into place ONLY if a takeover has taken place.?

Put the copy command in a "node_down_remote" post-event script. (If you have
more than two nodes in your cluster, you're going to have to do some further
work in that script to see if you're reacting to the failure of the
appropriate node. See the Admin Guide.)

--
______________
Tom Weaver (512) 838 8277, T/L 678-8277
tvweaver@[austin|us|vnet].ibm.com or TVWEAVER at [RTP|RALVM17]

0 new messages