On Tuesday 28 October 2008, Marc Balmer wrote: > * Bruce Bauer wrote: > > Problem: > > OpenBSD 4.2 on i386 > > Serial port /dev/cua00 connected to the console port on a firewall. > > I need to catch all text output from the serial port to a file. > > The process doing this must survive a loss of network. > > The box is running headless. > > I could suggest you run cu in a screen session. I have used > > cu ... | tee logfile > > in the past, but there are possibly more elegant solutions >
I've never tried using tee(1) but it is more elegant than using the default solution provided by tip/cu/remote. As is often the case, wanted the feature is in base, and has been there long enough for most people to both forget about it, and to some degree, most people no longer understand the language used to describe the features in the man page. The language used in man tip(1) and man remote(5) is accurate, but the problem is you'd need to be ancient to know what the language means. The problematic term in the man pages is "script" since it basically means "log file" In remote(5) you'll see an option for "re" which is a string to define to a path/filename, and an option for "sc" boolean which tells tip to turn on "scripting" The boolean options are turned on by just listing them (without the "=1" "=on" "=true" nonsense). Here's the default entry for "tty00" in /etc/remote tty00|For hp300,i386,mac68k,macppc,mvmeppc,vax:\ :dv=/dev/tty00:tc=direct:tc=unixhost: Here's the entry for my "tty00" in /etc/remote tty00|For hp300,i386,mac68k,macppc,mvmeppc,vax:\ :dv=/dev/tty00:tc=direct:sc:re=/home/jcr/tip.txt:tc=unixhost: If I do a simple # tip tty00 And boot the serial connected host, everything shows up on screen just like always *BUT* all of the output is also written to the given file. You might might also want to look over the beautify ("be"), line ending and escape sequence stuff in man remote(5) to tweak the text file output to your liking. -- jcr