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!

Query modem with ati7 and sen result to log file.

Status
Not open for further replies.

JohnLynn

Technical User
Feb 2, 2001
38
0
0
US
I need to script some way to query a modem and send the result to a log file.

I have tried cat and cu. I can not seem to get the debug into a log. Dont care which tool I use.

Thanks for the review.

John G. Lynn
 
Write a shell script to query the modem and send the results of that shell script into a log file. Then parse as needed. You can do this one of two ways:

(Inside the shell script)
exec 1>> modem_query.log # Some log name, STDOUT
exec 2>> modem_query.log # Some log name, STDERR

OR:

./modem_query.ksh > modem_query.log 2>&1

If you do not want the errors, then send them to /dev/null.
 
Have you tried expect with cu ?

Hope This Help
PH.
 
SOLUTION, read man page 499 times, tested with
cu -d -l /dev/ttyS0. Lots of help from Google and a little luck and lots of tries.



#!/bin/bash
# this script is to return the modem type
# you could use it to dial just as easy
# atdt1234\r instead of ati7\r

{

# one char at at time
echo -en "a"
echo -en "t"
echo -en "i"
echo -en "7"
echo -en "\r"
sleep 1
echo "~." # exit

} | cu -l /dev/ttyS0 >> log.txt 2>&1
exit

thanks for the help

John G. Lynn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top