Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
share|improve this question
Hi, what exactly is your question here? All you've written is a what you need, but we don't know exactly what's wrong. We don't know your script, how it works, or how it fails. Can't help you at all without much more details. – Mat Apr 14 '13 at 10:49
thats the problem, right now there is no unix script, just one for windows. Since those commands will not work, guess i need to build from scratch. thats hard when you dont know that much about it... – SimBox.NL Apr 16 '13 at 0:32
Revision 4: very helpful. Revision 6: less helpful. I think the Windows example probably cleared things up, so I reopened the question – Michael Mrozek Apr 16 '13 at 1:15

OK, to get the log from the box, you probably just need to do

netcat fritz.box 1012 >> log.txt

Your distribution might name the netcat program nc.

The Windows script you posted above is wrong, since it kills all telnet instances – and superfluous, since all it does is append log.txt to log.old.

If you want the latest part of the log, simply run tail -100 log.txt.

share|improve this answer
the connection SHOULD be watched if the link is up. The current client just stops after 15-60min without any warning at all. Right now i cannot check if this connection is active or broken... To avoid this it disconnects after 10min and restarts the connection. will also look at netcat, maybe it has some form watchdog... – SimBox.NL May 14 '13 at 18:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.