Find the remote server status.

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find the remote server status.
# 1  
Old 01-20-2014
Find the remote server status.

Hi All,

I would like to connect from "Instance A" to "Instance B" with the help of sftp.
Where as Instance B is having clustered servers ( 2 servers pointing same instance ).

Now, my question is before connecting to "Instance B" from "Instance A" how do know whether server is running or not. Based on which i can connect to the running server ignoring the server which is down.

Note :: Both A and B are UNIX servers. While B is clustered.

Please help me with the best approach.
# 2  
Old 01-20-2014

I think that you doesn´t need to check before connect, only you shoutd "atack" to cluster IP, instead to the servers.
# 3  
Old 01-20-2014 by IP address. Let the cluster worry about the actual node you attach to in the case of B. Unless you can ping the unique IP addresses of the nodes that comprise the cluster (this of course depends on how the ip address is "shared" on the cluster nodes; i.e. round-robin) .

You can test the success/failure of the ping or the sftp (the ping is probably faster to give results since you can control it with a -c Count and -w timeout options). I would also trust ping more so than sftp for returning status of failure or success.

So you can do something like...

if ping -q -c3 -w 3 A
  sftp .... to A
else if ping -q -c3 -3 5 B
 sftp to B
 echo "Failed to sftp to either A or cluster B"

or suppose you can ping the unique addresses of cluster B, say B1 and B2 (make sure you can, because cluster nodes unique ip addresses could be on a different segment depending on the cluster)...not really different...

if ping -q -c3 -w3 A
  sftp .... to A
else if ping -q -c3 -w3 B1
 sftp... to B1
else if else if ping -q -c3 -w3 B2 
 sftp... to B2
 echo "Failed to sftp to either A or B1 or B2"

I did not test this but you should be able to get the idea.
# 4  
Old 01-20-2014
If the requirement is to work on the application supported by the cluster and you have a shared IP address that the cluster serves, then it should not matter where you actually attach to. The updates should be to common disk. If the cluster IP address is not responding then you have bigger problems.

If you need to connect to each server for an infrastructure reason that is outside the application that the cluster is serving, then use the persistent host specific IP addresses.

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script connect to remote server, not find files and exit only from remote server, but not from scrip

I have a script, which connecting to remote server and first checks, if the files are there by timestamp. If not I want the script exit without error. Below is a code TARFILE=${NAME}.tar TARGZFILE=${NAME}.tar.gz ssh ${DESTSERVNAME} 'cd /export/home/iciprod/download/let/monthly;... (3 Replies)
Discussion started by: digioleg54
3 Replies

2. Shell Programming and Scripting

Error when connecting to remote server to find files with timestamp today's day

I am connecting to remote server and try to check if files with timestamp as Today's day are on the directory. Below is my code TARFILE=${NAME}.tar TARGZFILE=${NAME}.tar.gz ssh ${DESTSERVNAME} 'cd /export/home/iciprod/download/let/monthly; Today=`date +%Y%m%d`; if ;then echo "We... (1 Reply)
Discussion started by: digioleg54
1 Replies

3. Shell Programming and Scripting

Sudo connect to a remote server and execute scripts in remote server

Hello Every one!! I am trying to write a shell script which will connect to a remote server and execute scripts which are at a certain path in the remote server. Before this I am using a sudo command to change the user. The place where I am stuck is, I am able to connect to the... (6 Replies)
Discussion started by: masubram
6 Replies

4. Shell Programming and Scripting

Check/get the exit status of a remote command executed on remote host through script

Geeks, Could you please help me out in my script and identify the missing piece. I need to check/get the exit status of a remote command executed on remote host through script and send out an email when process/processes is/are not running on any/all server(s). Here's the complete... (5 Replies)
Discussion started by: lovesaikrishna
5 Replies

5. Shell Programming and Scripting

Shell script to find the GB files in /tmp directory in remote server

Hi, i need help on shell scripting. Main intention of the script is step 1: ssh to remote server Step 2: cd /tmp in remote server Step 3: in tmp i want to grep only files and directories which are in GB sizes All the servers list file is - tmpsrv.txt vi tmpsrv.txt ... (17 Replies)
Discussion started by: kumar85shiv
17 Replies

6. Shell Programming and Scripting

Find and replace a string on remote server

Main script command ssh export "'$ProjectTarget'" < /webdata/ecif/etl/scripts/ #!/bin/bash for file in find /devl/bfx/ecif/etl/$ProjectTarget/parameterfiles/ -exec grep -l CNTCT{} \; do ls -l $file sed -e 's/CNTCT/CNTCTST/' $file >... (15 Replies)
Discussion started by: nitinmathur18
15 Replies

7. UNIX for Dummies Questions & Answers

Long listing of files using find command on remote server via SSH

Hi , I am trying to find some files on a remote machine using the find command. >ssh -q atukuri@remotehostname find /home/atukuri/ -name abc.txt /home/atukuri/abc.txt The above command works fine and lists the file, but if I want to do a long listing of files (ls -l) its not working . ... (2 Replies)
Discussion started by: atukuri
2 Replies

8. Shell Programming and Scripting

Find match in two diff file - local srv and remote server

Perl Guru.... I need to compare two diff file ( will locate in current server and will locate in remote server), basically the script will look for match in both file and only will send out email if there is no match and also give me list of unmatch and dups as well. So... (0 Replies)
Discussion started by: amir07
0 Replies

9. Shell Programming and Scripting

Find files not accessed on a remote server and delete - Help!

Hi Guys, I am currently working on a script to find all the files that have not been accessed for the past 2 years. This, i guess has been discussed n number of times in this forum. Now, my requirement is to find all the files in the remote windows server. I have it mounted in unix. I was... (1 Reply)
Discussion started by: bond_bhai
1 Replies

10. Shell Programming and Scripting

How to check the file status in a remote server?

Hi All, Thanks in Advance. My requirement is there are some data files to be updated(some times new files get created) regularly in server A, these files are to be updated to the server B(backup server) by using SCP, I have to write a script for this purpose, before copying the files to server... (3 Replies)
Discussion started by: rajus19
3 Replies
Login or Register to Ask a Question