|
Home > Archive > Unix administration > March 2005 > crontab condition
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| NKSIII@hotmail.com 2005-03-29, 7:50 am |
| Has anyone had any luck w/creating a crontab condition? Our primary
configuration is a pair of Sun clustered nodes. Since only one node is
hosting the production configuration (at any one time), we have been
manually commenting / uncommenting crontab entries depending on the
active server. More recently I have been standardising the entries, but
prefacing each w/a test for a application that would only be running on
the active node (i.e. pgrep -f applicationname &&
activenodescript.csh). Although the pgrep only returns a PID when the
application is present (as expected), the statement is still being
executed on both the primary and secondary nodes. Any ideas how / why
this is incorrect?
| |
| Greg Beeker 2005-03-30, 5:58 pm |
|
NKSIII@hotmail.com wrote:
> Has anyone had any luck w/creating a crontab condition? Our primary
> configuration is a pair of Sun clustered nodes. Since only one node
is
> hosting the production configuration (at any one time), we have been
> manually commenting / uncommenting crontab entries depending on the
> active server. More recently I have been standardising the entries,
but
> prefacing each w/a test for a application that would only be running
on
> the active node (i.e. pgrep -f applicationname &&
> activenodescript.csh). Although the pgrep only returns a PID when the
> application is present (as expected), the statement is still being
> executed on both the primary and secondary nodes. Any ideas how / why
> this is incorrect?
In our AIX HACMP cluster environment we use the following script to
decide which is the active node before running a backup. The key is
that the netstat will only allow the active node to show with a 'svc1'
address.
netstat -i | grep svc1 > /dev/null
if [ $? -eq 0 ]
then
run_backup
else
echo "This is not the Active Node" > tmplog
fi
| |
| NKSIII@hotmail.com 2005-03-30, 5:58 pm |
| Cheers, Greg!
I am guessing that you embed that in all the various scripts, or do you
do something w/i the crontab entry?
| |
| Greg Beeker 2005-03-31, 8:12 am |
|
NKSIII@hotmail.com wrote:
> Cheers, Greg!
> I am guessing that you embed that in all the various scripts, or do
you
> do something w/i the crontab entry?
Exactly, we embed that code fragment in all the scripts called from
cron.
| |
| Dave Hinz 2005-03-31, 6:21 pm |
| On 31 Mar 2005 05:06:29 -0800, Greg Beeker <gbeeker@gmail.com> wrote:
>
> NKSIII@hotmail.com wrote:
> you
>
> Exactly, we embed that code fragment in all the scripts called from
> cron.
Same way we do the "last friday of the month" type things. Run every friday,
have the script itself decide if it needs to run further than the "is it
time?" part of the script or not. Much more, well, scriptable, if you
do the logic within the script.
Dave Hinz
|
|
|
|
|