Well,  I trap phone system data from the serial port. I have a start-up
script in my rc.local file that pipes the data to a file:

[EMAIL PROTECTED] rc.d]$ cat /usr/bin/osas_logsrxcalls
/usr/bin/osas_rotatesrxcalls
# Remember, call this script with a background argument '&'
cat < /dev/ttySR11 | sh -c 'while read line; do echo "$line" >>
/usr/ip/osas/arc
hive/SRX_CALLS ; done'

The pipe ensures that the SRX_CALLS files is "movable" with the cat process
breaking or following the moving inode.  My osas_rotatesrxcalls does this:

# Rotate captured text file
if [ -f /usr/ip/osas/archive/SRX_CALLS ]
then
/bin/mv /usr/ip/osas/archive/SRX_CALLS_9 /usr/ip/osas/archive/SRX_CALLS_10
/bin/mv /usr/ip/osas/archive/SRX_CALLS_8 /usr/ip/osas/archive/SRX_CALLS_9
/bin/mv /usr/ip/osas/archive/SRX_CALLS_7 /usr/ip/osas/archive/SRX_CALLS_8
/bin/mv /usr/ip/osas/archive/SRX_CALLS_6 /usr/ip/osas/archive/SRX_CALLS_7
/bin/mv /usr/ip/osas/archive/SRX_CALLS_5 /usr/ip/osas/archive/SRX_CALLS_6
/bin/mv /usr/ip/osas/archive/SRX_CALLS_4 /usr/ip/osas/archive/SRX_CALLS_5
/bin/mv /usr/ip/osas/archive/SRX_CALLS_3 /usr/ip/osas/archive/SRX_CALLS_4
/bin/mv /usr/ip/osas/archive/SRX_CALLS_2 /usr/ip/osas/archive/SRX_CALLS_3
/bin/mv /usr/ip/osas/archive/SRX_CALLS_1 /usr/ip/osas/archive/SRX_CALLS_2
/bin/mv /usr/ip/osas/archive/SRX_CALLS /usr/ip/osas/archive/SRX_CALLS_1
fi
/bin/cp /usr/ip/osas/archive/SRX_START_1 /usr/ip/osas/archive/SRX_START
stty -echo -echoe -echok -echoctl -echoke < /dev/ttySR11


The last stty line just makes sets the serial settings - done a boot time.
Linux is good about remebering serial settings.  On other unix systems you
have to wrap the stty command inside an infinite while loop to make the
process hold the tty settings - yuck.  Go Linux!
-eric wood


----- Original Message -----
From: "Al Sparks" <[EMAIL PROTECTED]>
> Using a mechanism like
>     $ cat /dev/ttyS0 >> some_file
> makes it easier to rotate logs.
>
> When I've tried it in the past, though, I've gotten garbage.  When I
> turned to minicom, I was able to adjust the baud rage, stop bits, and
> parity to make things work.



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to