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

Re: netcat in listen mode don't exit



When the date was Wednesday 11 February 2009, Paulo Brito wrote:

> 2009/2/11 Michael Iatrou <m.iatrou@freemail.gr>
>
> > When the date was Wednesday 11 February 2009, Paulo Brito wrote:
> > >  I"m trying to setup netcat so it serves logs to other systems. When
> > > a client connects, the server starts to send some logs.
> > >
> > > I run netcat in listem mode like this:
> > >
> > > # nc -l -p 5558 -c "tail -f /var/log/syslog"
> >
> > while :; do nc -l -p 5558 -c "tail -f /var/log/syslog"; done
> >
> Michael, thanks for your reply. But if you read my entire email, you'll
> see that the problem is netcat NOT exiting after disconnect. So, your
> script will not solve the problem, because the nc never exits.

You execute ``tail -f'', which actually never returns. You may try the -w 
delay option:

	# while :; do nc -l -w 10 -p 5558 -c "tail -f /var/log/syslog"; done

Please avoid top posting.

Thanks,

-- 
 Μιχάλης Ιατρού (jbkl)


Reply to: