Little script with minicom


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Little script with minicom
# 50  
Old 04-23-2012
Code:
#!/bin/bash
# revision 2
modem=/dev/ttyUSB3
apn='web.omnitel.it'
m2m_host=82.91.28.127
m2m_port=9940
file=/home/giuseppe/Desktop/SCRIPTMODEM/imsi.txt

# print error to stderr and exit unsuccessfully
die() {
	echo "$@" >&2
	exit 1
}

# chat helper. try everything twice.
send_expect() {
	chat ABORT ERROR '' "$@" '\c' ||
	chat ABORT ERROR '' "$@" '\c' ||
	echo "Exit code: $?" >&2
}

# keep modem open, so CD doesn't go low and drop connection
# move terminal to FD3 to avoid redirects on everything else ...
exec 3<&1 >"$modem" <"$modem"

# setup modem options ...
stty -clocal cs8 -parenb -cstopb

[ -e "$modem" ] || die 'Modem not connected'
send_expect 'AT+CREG?' '+CREG: 0,1' ||
	die 'Modem not registered'
send_expect "AT!PADSETUP=1,2,${m2m_host},0,${m2m_port},0,1" 'OK' ||
	die 'M2M connection failed'
send_expect 'AT+CGDCONT=1,"IP","'"$apn"'"' 'OK' ||
	die 'APN setup failed'
send_expect 'AT!PADCONN=1' 'CONNECT' ||
	die 'Unable to open socket'

cat "$file"

# give user idea of success
echo "done" >&3

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Alternatives to minicom During Remote Access?

Hey All, I am trying to find something similar to minicom, but it needs the ability to be ran during a remote dialup session on the remote device's side. If I dial into the remote server (*using minicom) and then try to run minicom on the remote server I get the following: # minicom... (20 Replies)
Discussion started by: mrm5102
20 Replies

2. SCO

Minicom

hello is there a copy of minicom or equivalent for unixware 7? thanks (3 Replies)
Discussion started by: deus-programmer
3 Replies

3. Shell Programming and Scripting

Expect script not working in crontab with minicom

Hi All, I am testing expect script in command prompt without issue, but in crontab it is not working, i check the output error as below: #cat /var/log/testexp.log spawn minicom -C /var/log/minicom1.log No cursor motion capability (cm) AT+COPS=? I am new in scripting, together... (1 Reply)
Discussion started by: elingtey
1 Replies

4. Shell Programming and Scripting

Help with minicom script

I'm a fairly new user to Linux based systems and am still a little uncomfortable with using the command interface. I'm trying to get my feet wet but have unfortunately hit a wall and am actually not even sure what I am trying to accomplish is at all possible. Basically, I am trying to use a... (0 Replies)
Discussion started by: nrdk00
0 Replies

5. Shell Programming and Scripting

Exiting from Minicom on a shell script

This is what I've tried: #!/bin/sh send sh send showifs send exit ! killall minicom My problem is that for some reason when I do this it doesn't give me the results of the prior commands sent like showifs So I suspect my syntax is wrong. (1 Reply)
Discussion started by: uradunce
1 Replies

6. Shell Programming and Scripting

minicom works, but stty does not

Hi all, I have some trouble getting stty to talk to some serial/usb converter. Getting minicom to work was however quite simple after I entered the following settings in addition to its standard-setup: pu port /dev/ttyUSB0 pu baudrate 19200 pu bits 8 pu... (3 Replies)
Discussion started by: pa-trick
3 Replies

7. Shell Programming and Scripting

expect minicom

Hi, I am new to using minicom. I want how to write a expect script for minicom login? I wrote a code but its not acting what iam expecting. here I have my code: #!/usr/bin/expect set fd fconfigure $fd spawn -open $fd spawn minicom expect “enter:” send "\n" send "\n" ... (3 Replies)
Discussion started by: vanid
3 Replies

8. Shell Programming and Scripting

running scripts in minicom

Hi, I am new to use minicom. I want script to run on minicom with username and password as automated.(Expect). please could anyone suggest the sample code for it. Thanks in advance (2 Replies)
Discussion started by: vanid
2 Replies

9. UNIX for Dummies Questions & Answers

Minicom Scripting

Does anyone have a working minicom script they would care to post as I can't get the scripting working and the scriptdemo and unixlogin sample scripts are on my system either. Thanx, I (2 Replies)
Discussion started by: ianf
2 Replies

10. UNIX for Dummies Questions & Answers

linux - minicom

hello. i'm attempting to use minicom in linux, but i'm having some difficulties. When i type in "minicom", the application opens up. It says 'starting minicom/finding modem'(something like that). However, once it actually starts, I can't do anything. No matter what I type in, it doesn't work. ... (2 Replies)
Discussion started by: kickboxer
2 Replies
Login or Register to Ask a Question
uudemon(4)						     Kernel Interfaces Manual							uudemon(4)

NAME
uudemon.admin, uudemon.cleanu, uudemon.hour, uudemon.poll - Administrative shell scripts for polling remote systems, cleaning up spool directories, reporting status to the system administrator, and routine invocations of the uuxqt and uusched daemons SYNOPSIS
These shell scripts reside in the following directory: /usr/lib/uucp DESCRIPTION
All the scripts can be run from the command line or can be run automatically by the cron daemon. To automatically run the scripts, remove the comment character (#) from the beginning of the relevant line in the /var/spool/cron/crontabs/uucp file. This script reports status to the system administrator. It issues the uustat command to find out the status of uucp jobs. It mails the results to the uucp login ID. The script may be modified to send mail to any login ID such as the uucp administrative login ID (uucpa) or root. This script cleans up the /var/spool/uucp and /var/spool/uucppublic directories by running the uucleanup command. The uucleanup com- mand is run with the following parameters: -C7, -D7, X2, -o2, -W1. This script runs the uusched and uuxqt daemons in the background. This script polls the systems listed in the /usr/lib/uucp/Poll file. The uudemon.poll script should be scheduled before the uudemon.hour script. This allows uudemon.poll to create any command files before cron runs the uudemon.hour script. FILES
Contains the uudemon.admin, uudemon.cleanu, uudemon.hour and uudemon.poll files. Contains the uucp file. RELATED INFORMATION
Commands: cron(8), uucleanup(8), uusched(8), uuxqt(1) Files: /usr/lib/uucp delim off uudemon(4)