Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

nc tool different on different dists - seriously?



Will this work on both distros:
(echo stats ; echo quit ) | nc localhost 11211

-Chris

On Fri, Oct 8, 2010 at 5:42 PM, Derek Martin <invalid-yPs96gJSFQo51KKgMmcfiw at public.gmane.org> wrote:

> On Fri, Oct 08, 2010 at 05:14:08PM -0400, theBlueSage wrote:
> > After 'man'ing the tool on both machines it appears the CentOS version
> > truly does not have the '-q' option, and that the Ubuntu version really
> > needs it.
> >
> > How is it possible that such a nice tool can get soooo messed up? Anyone
> > know a way around this?
>
> There are probably any number of approaches.  For example, I don't
> believe CentOS has /etc/lsb-release, but Ubuntu does... so you can do
> something like this:
>
>  # Figure out what to run
>  nc_option=""
>  if [ -f /etc/lsb-release ]; then
>      nc_option="-q1"
>  fi
>  nc_command="nc $nc_option localhost 11211"
>
>  # Now run it
>  echo "stats" | $nc_command
>
> A better approach would be to test netcat directly...  You could set
> up a routine that runs a netcat command with the -q option, and
> captures the stderr, and do the right thing based on that...
>
> --
> Derek D. Martin    http://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
> -=-=-=-=-
> This message is posted from an invalid address.  Replying to it will result
> in
> undeliverable mail due to spam prevention.  Sorry for the inconvenience.
>
>
> _______________________________________________
> Discuss mailing list
> Discuss-mNDKBlG2WHs at public.gmane.org
> http://lists.blu.org/mailman/listinfo/discuss
>
>






BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org