lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 15 Apr 2011 13:14:04 -0700
From:	Randy Dunlap <rdunlap@...otime.net>
To:	Christian Boltz <netdev-vger-kernel.org@...ltz.de>
Cc:	netdev@...r.kernel.org
Subject: Re: Feature request: "inverted" ping -a (beep on failure)

On Fri, 15 Apr 2011 22:11:45 +0200 Christian Boltz wrote:

> Hello,
> 
> Am Freitag, 15. April 2011 schrieb Randy Dunlap:
> > On Fri, 15 Apr 2011 21:35:32 +0200 Christian Boltz wrote:
> > > I'd like to have the exact opposite of it: beep when pinging fails.
> [...]
> > Couldn't you look for exit code (status) 1 and then do a bell/beep
> > (or play a sound file :)?
> 
> That would require that I know in advance when exactly the server is 
> unreachable - but in this case, I wouldn't need to ping it ;-)

I didn't follow that, but it's OK.

> To have this working, ping would need an option "exit on error", which 
> it doesn't have AFAIK.

'man ping' discusses exit status codes:

       If  ping  does  not  receive any reply packets at all it will exit with
       code 1. If a packet count and deadline are both  specified,  and  fewer
       than  count  packets are received by the time the deadline has arrived,
       it will also exit with code 1.  On other error it exits  with  code  2.
       Otherwise  it exits with code 0. This makes it possible to use the exit
       code to see if a host is alive or not.


> A workaround is to run ping -c1 in a loop:
> 
> while true ; do       If  ping  does  not  receive any reply packets at all it will exit with
       code 1. If a packet count and deadline are both  specified,  and  fewer
       than  count  packets are received by the time the deadline has arrived,
       it will also exit with code 1.  On other error it exits  with  code  2.
       Otherwise  it exits with code 0. This makes it possible to use the exit
       code to see if a host is alive or not.
>     ping -c1 $server || beep
>     sleep 1
> done
> 
> but I'd prefer to have something like this directly in ping ;-)
> 
> > Or do you want ping to beep and then continue running?
> 
> Yes, that's exactly what I want.


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ