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

Re: Bash Script for Mail sending Check



On Thu, Apr 16, 2009 at 03:38:23PM +0200, Brent Clark (brentgclarklist@gmail.com) wrote:


> what Im really trying to say is that your  
> code may look a lot neater and easier, as opposed to
>
> case "$( (sleep 5; echo quit; ps |awk '/telnet/{print "kill "$1}' |sh) | telnet > 192.168.0.20 25 2>&- )
>
> nc -v -w 5 -z 192.168.0.20 25

Neater, yes, but the functionality is not equivalent.
As I understood it, OP specifically wanted to test if they
can connect to the mail server, not just if port 25 is open.

Also, common though nc nowadays is, it's still not present
in every system, and if you have to install a new program
for the purpose you might as well install swaks.

Finally, irrelevant though it may be to Debian, portability
will suffer from every new external program you need.
Ugly though that kill hack is, it'll work in more or less
every *ix-related box, as it only uses standard POSIX tools.

-- 
Tapani Tarvainen


Reply to: