On Wed, 05 Jul 2017 01:57:05 +0200 Florian Zieboll <f.zieb...@web.de> wrote:
> Am 5. Juli 2017 01:07:21 MESZ schrieb Steve Litt > <sl...@troubleshooters.com>: > > > echo 'quit' | nc -w2 $1 $2 2>/dev/null 1>/dev/null > > For these kind of tests I use "nc -z $HOST $PORT". Like your > suggestion, it not only proves the host to be up, but also the wanted > service and times out after a couple of seconds, too - but you don't > need the "> /dev/null 2>&1" redirection. Yes! You still need the 2>/dev/null and you still need the -w2 for very rare hangs, but your version gets rid of a lot of objectionable stuff including prepiping "quit". So here's my revised version: ====================================== #!/bin/sh nc -w2 -z $1 $2 2>/dev/null return $? ====================================== Thanks! SteveT Steve Litt July 2017 featured book: Quit Joblessness: Start Your Own Business http://www.troubleshooters.com/startbiz _______________________________________________ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng