Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pulling data from /dev/tty??? to file

Status
Not open for further replies.

Swanky

Programmer
Jul 17, 2001
13
0
0
US
I have call accounting data coming in on tty1a12. My call accounting software reads this just fine. But now I am writing new software that also needs to read this data. The call accounting software is in DB/C and is from a vendor. Mine is in C.

Initially I was just going to do

cat /dev/tty1a12 >> /u/maid/smdr&

And then write a script to run in cron and make sure this was always going. I suppose a -NOHUP would help, but I have had trouble out of this and generally, I don't find it trustworthy.

But the problem is that this does not seem to work anymore. When I first tested my software I used the above line and got some sample data which I used to test with. Now that I am ready to put this out live, when I use the above line, I get incomplete data. It's as though it gets only 1/2 the data line. The call accounting is still getting complete data records though.

So what would you guys suggest to read this data stream in a non-blocking fashion? Is there a more reliable and graceful way to "dup" this stream? What is generally coming out is a 110 byte call record, at random intervals. But you cannot count on it being exactly 110 bytes.

Thanks,
Tim
 
Tim -

How about using your C program to read the stream and then putting the data records out to a maintainable file or a database table. If your accounting application needs to block on input you could use a named pipe and have the C program write each record to the pipe after it's done with it.

Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top