I am trying to implement a simple log server in Bash. It should take a file as a parameter and serve it on a port with netcat.
( tail -f $1 & ) | nc -l -
This works for me (SLES Linux):
tail -F xxxx | tee -a yyyy &
export TAIL_PID=`jobs -p`
# export TEE_PID="$!"
The ps|grep|kill trick mentioned in this thread would not work if a user can run the script for two "instances" on the same machine.
jobs -x echo %1 did not work for me (man page not having the -x flag) but gave me the idea to try jobs -p.