Operating System - HP-UX
1836375 Members
2180 Online
110100 Solutions
New Discussion

Supress screen output while pinging

 
SOLVED
Go to solution
MAYIANAN
Advisor

Supress screen output while pinging

Hi all,

I need to handle ftp error in my script. what i need is i just want to ping and the status of it alone. I don want any screen output while ping. Please Help me out to handle this kind of error.
5 REPLIES 5
Safarali
Valued Contributor

Re: Supress screen output while pinging

hi Mayian
if you are using Broune shell use the following option
2>&1 or
you can user >& myerror

Regards
Safar
Fat Scrape
Honored Contributor
Solution

Re: Supress screen output while pinging

Hi,

Send standard error output on /dev/null

commnad args1 2 >/dev/null

Regards

MAYIANAN
Advisor

Re: Supress screen output while pinging

Thx all. i have proceeded with ping host > /dev/null.
MAYIANAN
Advisor

Re: Supress screen output while pinging

Thx
Tor-Arne Nostdal
Trusted Contributor

Re: Supress screen output while pinging

... a comment even though you have closed your thread...

Even though you're able to ping the remote server, that doesn't mean you would "handle FTP errors".

Instead of doing a ping and check the return code, you might want to actually do a ftp connect test...

Even if you can ping, it might not be an ftp-server available or the ports might be blocked by some firewall.
Even you're able to connect to the ftp server, you might not be able to login.

This is a fairly simple, but better example for checking:

ftp -in >FTPconnect.log 2>&1 <open HOST
user Username Password
bye
EOF_Connect

Then you could grep the file FTPconnect.log for strings like 'Connected' or 'logged in' etc.

/Tor-Arne
I'm trying to become President of the state I'm in...