Start scripts if it doesn't run on other node

Hello community,
I created a script to simply query DB and then analize data. The environment where the script will works is two RedHat machines that access both to an external database. My script runs from the first crontab node. But what about if the first node goes down?

What I need is copy the script to both nodes, and then start it from second node, ONLY when it doesn't run from the first one. :eek:

I'm thinking a simple solution. Second script check the avalability of the first node, then start only if it's not available, something like:

ping 192.168.10.7 -c1 > /dev/null 2>&1 && echo "1st node reachable do nothing and exit" || echo "1st node NOT Reachable, continue execution"

But this doesn't cover all the possbility issues on node 1 that prevent the script running.

What do you think about my solution? Do you have another better idea?

Thanks
Lucas

https://en.wikipedia.org/wiki/Red\_Hat\_cluster_suite

Thanks for your feedback, but unfortunately redHat machines is already installed/configured and in traffic. No cluster was created between them. I've to found a workaround for my own needs. :wink: