Sponsored Content
Full Discussion: issue a ping on a remote box
Top Forums Shell Programming and Scripting issue a ping on a remote box Post 302259844 by hcclnoodles on Wednesday 19th of November 2008 04:58:04 AM
Old 11-19-2008
issue a ping on a remote box

Hi there

I am running a script on a central box (boxA) that will send a remote request to boxB to perform a ping test to an ip

note: I am not pinging boxB from boxA but sending a request over ssh to get boxB to perform a ping test !

The thing is, I want the script back at boxA to know whether the remote ping was successful or not ...is this possible, i tried using this 'if' test condition hoping that a true/false would come back, am i doing something wrong?

Code:
[root@boxA] # vi test  

#!/bin/ksh -x

if [ `ssh boxB 'ping 172.1.1.1'` ]; then
echo "can ping from boxA"
else
echo "cant ping at all"
fi

NOTE: this ip is in fact definitely pingable from boxB but I get the following return from my script

Code:
[root@boxA] # ./test
+ FCEDIT=vi
+ export FCEDIT
+ set -o vi
+ + uname -n
PS1=boxA$ 
+ EDITOR=vi
+ export EDITOR
+ ssh boxB ping 172.1.1.1
+ [ 172.1.1.1 is alive ]
./test[5]: is: unknown test operator
+ echo cant ping at all
cant ping at all

As you can see from the bit highlighted in red above, the remote ping seems to be working, but how do I get my local script on boxA to be made aware of this

Any help on this would be greatly appreciated
 

10 More Discussions You Might Find Interesting

1. Cybersecurity

securing a remote box

someone has access to my server... I've got a solaris 7 box with remote access only. many of the services don't have passwords and someone recently messed with the shadow file -the root: line was changed: . password field was changed to NP . the number after that was changed too The... (8 Replies)
Discussion started by: sphiengollie
8 Replies

2. SCO

Openserver 5.0.4 can't be ping or telnet into from a remote site

Hi, Can anybody help me out why l can't not ping my server with Openserver 5.0.4 with my windows machine from a remote site. The machine could see the local LAN with the Router however, i can't ping or telnet unto the server from another site on the WAN. The default gateway was configure on the... (0 Replies)
Discussion started by: kayode
0 Replies

3. Programming

cathcing `mozilla -remote ping()` within c++

Here is my problem. An extension and alternative to my initial post https://www.unix.com/showthread.php?t=18043 This is what I have done so far to counter it. In my application, I have used /usr/bin/mozilla -remote "openURL(URL)" The -remote makes sure that I go and open the URL in an... (1 Reply)
Discussion started by: vino
1 Replies

4. Linux

Can't SSH / ping Linux box !!!

I have a linux box build11 which can be pinged from build18 (Windows) box. And we can only login to the box (using SSH) from build18 box. Plz help to characterize the problem, network, DNS, DHCP, etc (or whatever which I am unsure) Any idea what may be the reason ? :confused: Thanks in... (4 Replies)
Discussion started by: csaha
4 Replies

5. Shell Programming and Scripting

Help with Ping command for windows Box

Hi, I would like to write a script for checking the windows remote server has responding or not from Unix box. 123.34.56.222-- the windows remote server I wrote like: ping 123.34.56.222 PING 123.34.56.222: 64 byte packets 64 bytes from 123.34.56.222: icmp_seq=0. time=8. ms 64... (1 Reply)
Discussion started by: koti_rama
1 Replies

6. Linux

How to find remote Linux box login account without login in to that box?

Hi, How to find remote Linux box login account without login in to that box? I don't have login account at my remote Linux box. But I need who are all having login account. How do I findout? Thanks, --Muthu. (3 Replies)
Discussion started by: Muthuselvan
3 Replies

7. Red Hat

Can't ping my unix box by name

Hi All, I have recently setup a Windows 2003 server as AD / Domain Controller. In it, I have a VMWare for RHEL 4. I have 3 other computers connected to the network all using Windows 7. These computers can ping each other by name. But none of these can ping the Unix OS in the VMWare of the... (5 Replies)
Discussion started by: adshocker
5 Replies

8. AIX

Ping to remote host failed

Actually. I was getting a ping to remote host failed for one of my etherchannel. When I checked it was in backup adapter and again I use to faileover and brought to primary channel. But it was again going to backup channel and giving me the alert ping to remotehost failed. When I checked the load... (3 Replies)
Discussion started by: Mohamed Thamim
3 Replies

9. Shell Programming and Scripting

Notify when the script run(hourly)on my jump-box only when there is a failure on my remote-box

Team, Presently I have a script, which i have set up cron on one of my Jump-boxes,and gives me the output on every hourly basis,fetching the data from the remote machine.Basically it gives me the list of all active users logged and its count once we execute the script.Here the count is... (6 Replies)
Discussion started by: whizkidash
6 Replies

10. BSD

Ping remote sever, nc, telnet, whatever

I put this thread to shell and bsd, because I want to resolve this matter on bsd. May somebody can explain to me how to ping a remote server, in unix. BTW the following code examples were tried on a linux system as well, with the same output, nothing. But on my bsd are not installed nmap neither... (4 Replies)
Discussion started by: 1in10
4 Replies
nisping(1M)															       nisping(1M)

NAME
nisping - send ping to NIS+ servers SYNOPSIS
/usr/lib/nis/nisping [-uf] [-H hostname] [-r | directory] /usr/lib/nis/nisping -C [-a] [-H hostname] [directory] In the first line, the nisping command sends a ``ping'' to all replicas of an NIS+ directory. Once a replica receives a ping, it will check with the master server for the directory to get updates. Prior to pinging the replicas, this command attempts to determine the last update "seen" by a replica and the last update logged by the master. If these two timestamps are the same, the ping is not sent. The -f (force) option will override this feature. Under normal circumstances, NIS+ replica servers get the new information from the master NIS+ server within a short time. Therefore, there should not be any need to use nisping. In the second line, the nisping -C command sends a checkpoint request to the servers. If no directory is specified, the home domain, as returned by nisdefaults(1), is checkpointed. If all directories, served by a given server, have to be checkpointed, then use the -a option. On receiving a checkpoint request, the servers would commit all the updates for the given directory from the table log files to the data- base files. This command, if sent to the master server, will also send updates to the replicas if they are out of date. This option is needed because the database log files for NIS+ are not automatically checkpointed. nisping should be used at frequent intervals (such as once a day) to checkpoint the NIS+ database log files. This command can be added to the crontab(1) file. If the database log files are not checkpointed, their sizes will continue to grow. If the server specified by the -H option does not serve the directory, then no ping is sent. Per-server and per-directory access restrictions may apply; see nisopaccess(1). nisping uses NIS_CPTIME and NIS_PING (resync (ping) of replicas), or NIS_CHECKPOINT (for checkpoint). Since the NIS_PING operation does not return a status, the nisping command is typically unable to indicate success or failure for resyncs. -a Checkpoint all directories on the server. -C Send a request to checkpoint, rather than a ping, to each server. The servers schedule to commit all the transactions to stable storage. -H hostname Only the host hostname is sent the ping, checked for an update time, or checkpointed. -f Force a ping, even though the timestamps indicate there is no reason to do so. This option is useful for debugging. -r This option can be used to update or get status about the root object from the root servers, especially when new root replicas are added or deleted from the list. If used without -u option, -r will send a ping request to the servers serving the root domain. When the replicas receive a ping, they will update their root object if needed. The -r option can be used with all other options except with the -C option; the root object need not be checkpointed. -u Display the time of the last update; no servers are sent a ping. -1 No servers were contacted, or the server specified by the -H switch could not be contacted. 0 Success. 1 Some, but not all, servers were successfully contacted. Example 1: Using nisping This example pings all replicas of the default domain: example% nisping Note that this example will not ping the org_dir and groups_dir subdirectories within this domain. This example pings the server example which is a replica of the org_dir.foo.com. directory: example% nisping -H example org_dir.foo.com. This example checkpoints all servers of the org_dir.bar.com. directory. example% nisping -C org_dir.bar.com. NIS_PATH If this variable is set, and the NIS+ directory name is not fully qualified, each directory specified will be searched until the directory is found. See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWnisu | +-----------------------------+-----------------------------+ crontab(1), nisdefaults(1), nisopaccess(1), nislog(1M), nisfiles(4), attributes(5) NIS+ might not be supported in future releases of the SolarisTM Operating Environment. Tools to aid the migration from NIS+ to LDAP are available in the Solaris 9 operating environment. For more information, visit http://www.sun.com/directory/nisplus/transition.html. 12 Dec 2001 nisping(1M)
All times are GMT -4. The time now is 03:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy