My telephone system (fritzbox 7170) outputs log data on telnet and some form of script is needed to start it from
crontab, capture all data and write anything that comes in to a log file without delay.
It also has to be able to detect any disconnects, as it has to reconnect as fast as possible (lets say within a few seconds) so that no calls are lost.
The log-files will be used to monitor the line, send email alerts about all calls, change line status on my website and much more. Right now it works on Windows, but not on my Debian box (RaspberryPi).
On Windows it looks like this; (and runs every 10 min)
taskkill /f /im telnet.exe copy /B log.old+log.txt log.old sleep 1 del log.txt /f telnet.exe -flog.txt fritz.box 1012