Display serial terminal logs from printer
Q We have a small 5ESS switch which sends log files to a ROP (read-only printer) at 1200-O-7-1. The cable is the normal three-wire Unix serial cable. I have connected a PC to this using a Black Box bridge. The PC is running Windows 2000 with Procomm [a terminal emulator]. I can make a direct connection to the serial port and the logs are displayed on the screen. I am also capturing these displayed logs from the switch to a file (saves a lot of paper). I would like to do the same thing with Linux (so I can discard Windows) but am unable to make this work using tee or any redirections. Ideally, not only would this log display always be available in a window, it would continue to be captured in a file, even if the user were logged off. In addition, I would like a new file to be created every night at midnight, closing the old file. Can you help with the syntax or a workable method of doing this?
A The first program I would try for this is Minicom. This is a terminal emulator, much like Procomm, and should be in your distribution's software repository. If it isn't, you can get it from the website http:/ alioth.debian.org/projects/minicom. Minicom has an option to log data to a file as well as display it - so, providing it will communicate with your switch, it should do all you need. Alternatives involve more low-level communication with the serial port. There is Logserial from www.gtlib.cc.gatech.edu/pub/Linux/system/serial, which dumps the data from the specified serial port to stdout or a file; you could use tee to do both. There is also a Perl script available from http://aplawrence.com/Unix/logger.html, although this may require some modification to fit your requirements. To keep the program running all the time, run it in screen. This keeps the program ticking over when the user is logged out, plus you can reconnect to it at any time, even over an SSH connection from elsewhere. Provided you have set the logging and other options in Minicom's configuration, you can start it with
Press Ctrl+A D to exit screen while leaving Minicom running, and type screen -r to reconnect. One thing to watch out for when running Minicon in screen is that both use Ctrl+A as a command key; to get screen to pass Ctrl+A to a program running in it, press Ctrl+A A so you would use Ctrl+A A Z to show Minicom's help screen. I would use Logrotate to split the log files. This is probably already installed and running as most distros use it to rotate system log files.
- Get USB serial port replicator working under Linux
- Canon i865 printer won't work in Linux
- Disappearing display in OpenSUSE
- Canon LBP-1120 printer not working in Linux
- Using serial terminals in Linux