Sponsored Content
Top Forums Shell Programming and Scripting Find the remote server status. Post 302884449 by blackrageous on Monday 20th of January 2014 11:45:37 AM
Old 01-20-2014
Simple...ping 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...

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

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...

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

I did not test this but you should be able to get the idea.
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. Shell Programming and Scripting

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

Perl Guru.... I need to compare two diff file (file1.abc will locate in current server and file2.abc 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

4. 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

5. Shell Programming and Scripting

Find and replace a string on remote server

Main script command ssh user@server.XYZ.net export "'$ProjectTarget'" < /webdata/ecif/etl/scripts/dbchange.sh dbchange.sh #!/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

6. 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

7. 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

8. 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

9. 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

10. 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
Moose::Meta::Instance(3)				User Contributed Perl Documentation				  Moose::Meta::Instance(3)

NAME
Moose::Meta::Instance - The Moose Instance metaclass VERSION
version 2.1202 SYNOPSIS
# nothing to see here DESCRIPTION
This class provides the low level data storage abstractions for attributes. Using this API directly in your own code violates encapsulation, and we recommend that you use the appropriate APIs in Moose::Meta::Class and Moose::Meta::Attribute instead. Those APIs in turn call the methods in this class as appropriate. At present, this is an empty subclass of Class::MOP::Instance, so you should see that class for all API details. INHERITANCE
"Moose::Meta::Instance" is a subclass of Class::MOP::Instance. BUGS
See "BUGS" in Moose for details on reporting bugs. AUTHORS
o Stevan Little <stevan.little@iinteractive.com> o Dave Rolsky <autarch@urth.org> o Jesse Luehrs <doy@tozt.net> o Shawn M Moore <code@sartak.org> o XXXX XXX'XX (Yuval Kogman) <nothingmuch@woobling.org> o Karen Etheridge <ether@cpan.org> o Florian Ragwitz <rafl@debian.org> o Hans Dieter Pearcey <hdp@weftsoar.net> o Chris Prather <chris@prather.org> o Matt S Trout <mst@shadowcat.co.uk> COPYRIGHT AND LICENSE
This software is copyright (c) 2006 by Infinity Interactive, Inc.. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.18.2 2014-01-19 Moose::Meta::Instance(3)
All times are GMT -4. The time now is 10:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy