I'm trying to trigger a beep on the PC speaker for every unique visitor of a website.
After some brainstorming, it seemed to be possible with one line:
for e in `ssh me@mymachine "tail -n 1 -f /var/log/apache/test.log | awk '{print $1}' | uniq"`; do beep; done
However uniq doesn't output anything as long as stdin is open (seems to wait for EOF). The same goes for the for loop. If I remove the uniq from the chain, I still get no output with tail keeping the pipe open.
This seems not to be because of buffering. Even if I write >100.000 lines into the test file with this command running, there's no output on the other end.
Is there a way to get that working without completely killing the beauty (simplicity) of the solution?