Start scripts if it doesn't run on other node


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Start scripts if it doesn't run on other node
# 1  
Old 07-29-2012
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. Smilie

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:
Code:
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
# 2  
Old 07-29-2012
# 3  
Old 07-29-2012
Quote:
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. Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Publish and Subscribe to AES-256 Encrypted MQTT Messages to Node-RED from PHP Scripts

Various Node-Red crypto modules do not work with PHP, so to send an encrypted message from a PHP script (in this case from a Ubuntu server) to Node-RED we need our own code. After a few hours of searching, testing various libs, more testing and debugging, I got this PHP to Node-RED code... (0 Replies)
Discussion started by: Neo
0 Replies

2. Shell Programming and Scripting

Locating all the scripts which start with:#!

Hi, I need to find all the executable shell scripts under /home dirctory and its sub directories. I would like to print the path to the files , which include in the header of the file: #! (Actually its the first line of the file). I have tried : find . -name "*" -type f -exec sh -c ' ... (14 Replies)
Discussion started by: Yoav
14 Replies

3. UNIX for Dummies Questions & Answers

Scripts can be run manually but couldn't run with cronjobs

I am from MQ/MB technology. My requirement is to display the queue manger and broker status on daily basis. If I manually run the script, it works fine and displays output. But when I have scheduled the same using cronjobs it shows only the queue manger status and not the broker status. Can... (3 Replies)
Discussion started by: Anusha M
3 Replies

4. Shell Programming and Scripting

Cron doesn't run job in background

Hi, First of all merry christmas and Happy holidays to all :D My situation is as below, When a backup job runs on a mainframe server, it creates a 0byte file on a network drive which is accessible through linux Linux server : Red Hat Enterprise Linux Server release 5.3 Beta (Tikanga) File... (6 Replies)
Discussion started by: sam05121988
6 Replies

5. Shell Programming and Scripting

Script failing to run successfully on remote node

Hi guys, I have a scenario where i want to run a script from Node A. It ssh's into Node B and runs some awk commands there plus deposiriting the output on Node B. Challenge is that the awk commands run properly when executed locally on Node B but fail when within the script on Node B. I do not... (0 Replies)
Discussion started by: jerkesler
0 Replies

6. Shell Programming and Scripting

Doesn't run as a cronjob...

Hi! I have a svn backup script that works perfectly if I execute it from the command line but if I set it as a cronjob to run at night, only part of the code works. So, basically the scripts starts by deleting the folder yesterday and then moves the folder today to the folder yesterday. When... (4 Replies)
Discussion started by: ruben.rodrigues
4 Replies

7. UNIX for Dummies Questions & Answers

Script doesn't run

Hi everyone, I've written a script, I gave it permission by > chmod u+x myscript and then tried to run it with > myscript and it didn't work, so I've written > ./myscript again, it didn't work, so I've written > set path = (. $path) but it didn't work as well. I have some... (6 Replies)
Discussion started by: shira
6 Replies

8. HP-UX

fsck doesn't work - not even run?

Hi, please consider, I'm pretty new to HP-UX, thanks. Our server (rp7420 with HP-UX 11.31) has crashed due to disk write error (not boot partition). So I replaced damaged device with the new one of the same size and performed dd copy 1:1 to restore data - vxfs partition "/dev/vg01/lvol1"... (4 Replies)
Discussion started by: Morhoo
4 Replies

9. Shell Programming and Scripting

Start all scripts in a directory

Good morning. I have a tricky one here for me. Hope somebody can help. I am looking for a way to take a single script in a directory and use it to fire all scripts within a subdirectory. For example. Lets say I have the following in /lcl/prd/apps file1.sh file2.sh file3.sh file4.sh... (2 Replies)
Discussion started by: LRoberts
2 Replies

10. Shell Programming and Scripting

When things doesn't run into crontab???

Could someone explain my problem? I've the following script... #! /bin/ksh ... vmquery -m $MediaID | awk ' BEGIN {FS=": " getline expdate <"ExpDate.txt" } $1 ~ /media ID/ {MediaNumber = $NF} ... $1 ~ /number of mounts/ { "date +%Y"|getline YearToday Year4 = YearToday - 4 if... (4 Replies)
Discussion started by: nymus7
4 Replies
Login or Register to Ask a Question