IT运维人员经常使用telnet探测主机某一端口的连接情况。遗憾的是,telnet需要人工交互,无法用在脚本里。更甚,系统网络超时因设置或者具体情况的不同而不同。而telnet缺少选项对此加以控制,至少我是没有发现telnet有选项可以控制这一点。除此之外,似乎telnet也没有给出足够好的出错提示。其他一些工具,比如大名鼎鼎的“netcat”,也是不能给出足够“原汁原味”的网络错误提示。而这一点对运维人员判断网络问题十分必要。 cns被设计来替代telnet进行此类探测工作。cns是由C实现的命令行程序。如果网络连接正常,cns默认返回0,无任何提示。如果网络连接有问题,cns返回1,并在标准输出上打印系统提供的、“原汁原味”的出错字符串。一句话,cns就是设计来用在shell环境的。尤其是脚本中工作。 此程序直接编译即可用。
30 Day Summary May 12 2013 — Jun 11 2013
|
12 Month Summary Jun 11 2012 — Jun 11 2013
|
Copyright
©
2013
Black Duck Software, Inc.
and its contributors, Some Rights Reserved. Unless otherwise marked, this work is licensed under a
Creative Commons Attribution 3.0 Unported License
. Ohloh
®
and the Ohloh logo are trademarks of
Black Duck Software, Inc.
in the United States and/or other jurisdictions. All other trademarks are the property of their respective holders.