Jeff Abrahamson on 25 Oct 2004 12:28:02 -0000


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

[PLUG] ad hoc UDP listener


I want to run a log daemon on port 2000 using UDP.  So I tried

    port=2000
    nc -u -l -p $port >>$HOME/data/$file 2>/dev/null &

That works for a while, but eventually the port closes.  No problem,
thought it, I'll just do this:

    #!/bin/sh

    file=$1
    port=$2
    while true; do
	  nc -u -l -p $port >>$HOME/data/$file 2>/dev/null
    done &

I run this script, and whenever the UDP listener dies, it gets
restarted.  Nope, it turns out the listener stops listening but
doesn't necessarily quit.

This is for an ad hoc thing.  I just want to know when a certain
program is run and a bit about what happens to it, so said program
sends me UDP packets with status information.  I can check the log to
see what's happening.

Any suggestions on how to do this easily and more reliably?

Tia.

-- 
 Jeff

 Jeff Abrahamson  <http://www.purple.com/jeff/>    +1 215/837-2287
 GPG fingerprint: 1A1A BA95 D082 A558 A276  63C6 16BF 8C4C 0D1D AE4B

 A cool book of games, highly worth checking out:
 http://www.amazon.com/exec/obidos/ASIN/1931686963/purple-20

Attachment: signature.asc
Description: Digital signature