[ILUG] Serial Port Logging
kenn at bluetree.ie
Wed Sep 19 14:17:19 IST 2001
> Duplex is not an issue as this is a dumb, text only printer.
If the baud rate isn't too high, then call the guys at
www.bb-europe.com (they're located near Galway) and ask
for one of these:
(There's also a slightly cheaper 9-pin version.) Simply
insert this into the serial line to the printer and connect
your linux box to the tap connector.
Then do something like:
cat /dev/ttyS0 > printer.log
If the data is too fast and you get dropouts in printer.log, then
just get a faster linux box.
A more "production version" would something along the lines of
mkdir -p /var/log/printlog
chmod 700 /var/log/printlog
echo $$ > /var/run/printlog.pid
cat /dev/ttyS0 > /var/log/printlog/`date "+%Y-%m-%d-%H:%M:%S"`.log
And then an entry in /etc/cron.daily that does
kill -INT `cat /var/run/printlog.pid`
to rotate the logs (or use logrotate instead)
More information about the ILUG