Computing.Net > Forums > Unix > Ping Problem

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Ping Problem

Reply to Message Icon

Name: swr_nagle
Date: July 17, 2002 at 10:04:33 Pacific
Comment:

I have one script file to take backup of certain files. It has following commands :
ping -c1 -i3 $IPADR >/dev/null 2>/dev/null

if test $? -eq 0; then
#cleanup old data files
rm -f /tmp/data.zip 2>/dev/null

i.e. it first pings $IPADR & checks if ping is successful by seeing result in $?. If ping is successful, then, it should result 0. The script has been written under that assumption. However, when i run this script on two different machines, on which ping is successful. But, one gives result $? = 0 & other one gives $?=1. What could be going wrong.If i ping IPADR, it is successful on both machines.



Sponsored Link
Ads by Google

Response Number 1
Name: tom z.
Date: July 18, 2002 at 03:25:03 Pacific
Reply:

Couple of issues, which shell is the script written in and are you using the same flavor and version of UNIX on both systems?

Verify those first and then consider script changes, till then, the $?=1 value, if that is the whole script, just will not be deleting any files.


0

Response Number 2
Name: swr_nagle
Date: July 18, 2002 at 06:32:22 Pacific
Reply:

Hello Tom,

I appreciate your reply. The script is written in Bourne shell. On both systems, I have QNX4.25 OS loaded, with same application softwares running.

The mentioned above is only some part of script. It does more things after checking value of "$?". I have only indicated the part which is crucial & giving problems.

Generally, "$? >> 8" represents exit value of subprocess. "$? & 127" indicates signal name, if any, the process died from and "$? & 128" represents core dump. Am i right?

Awaiting your comment.

Thanks & Best Regards.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Ping Problem

LAN set up but Ping problem www.computing.net/answers/unix/lan-set-up-but-ping-problem/5891.html

Problem with ping & echo $? www.computing.net/answers/unix/problem-with-ping-amp-echo-/3484.html

ping help www.computing.net/answers/unix/ping-help/5619.html