diff options
author | Dexter Morgan <dmorgan@mageia.org> | 2011-06-02 20:51:35 +0000 |
---|---|---|
committer | Dexter Morgan <dmorgan@mageia.org> | 2011-06-02 20:51:35 +0000 |
commit | a9b2bdafaf625d10aef2f476aa4014fd36c846bc (patch) | |
tree | 2364afc0ee6739b59a25c44d68c9f003bcaf03d9 /mdk-stage1/ppp/scripts/redialer | |
download | drakx-a9b2bdafaf625d10aef2f476aa4014fd36c846bc.tar drakx-a9b2bdafaf625d10aef2f476aa4014fd36c846bc.tar.gz drakx-a9b2bdafaf625d10aef2f476aa4014fd36c846bc.tar.bz2 drakx-a9b2bdafaf625d10aef2f476aa4014fd36c846bc.tar.xz drakx-a9b2bdafaf625d10aef2f476aa4014fd36c846bc.zip |
Branch for updates
Diffstat (limited to 'mdk-stage1/ppp/scripts/redialer')
-rwxr-xr-x | mdk-stage1/ppp/scripts/redialer | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/mdk-stage1/ppp/scripts/redialer b/mdk-stage1/ppp/scripts/redialer new file mode 100755 index 000000000..5bbde4e9d --- /dev/null +++ b/mdk-stage1/ppp/scripts/redialer @@ -0,0 +1,96 @@ +#!/bin/sh +################################################################### +# +# These parameters control the attack dialing sequence. +# +# Maximum number of attempts to reach the telephone number(s) +MAX_ATTEMPTS=10 + +# Delay between each of the attempts. This is a parameter to sleep +# so use "15s" for 15 seconds, "1m" for 1 minute, etc. +SLEEP_DELAY=15s + +################################################################### +# +# This is a list of telephone numbers. Add new numbers if you wish +# and see the function 'callall' below for the dial process. +PHONE1=555-1212 +PHONE2=411 + +################################################################### +# +# If you use the ppp-on script, then these are passed to this routine +# automatically. There is no need to define them here. If not, then +# you will need to set the values. +# +ACCOUNT=my_account_name +PASSWORD=my_password + +################################################################### +# +# Function to initialize the modem and ensure that it is in command +# state. This may not be needed, but it doesn't hurt. +# +function initialize +{ + chat -v TIMEOUT 3 '' AT 'OK-+++\c-OK' + return +} + +################################################################### +# +# Script to dial a telephone +# +function callnumber +{ +chat -v \ + ABORT '\nBUSY\r' \ + ABORT '\nNO ANSWER\r' \ + ABORT '\nRINGING\r\n\r\nRINGING\r' \ + '' ATDT$1 \ + CONNECT '' \ + ogin:--ogin: $ACCOUNT \ + assword: $PASSWORD +# +# If the connection was successful then end the whole script with a +# success. +# + if [ "$?" = "0" ]; then + exit 0 + fi + + return +} + +################################################################### +# +# Script to dial any telephone number +# +function callall +{ +# echo "dialing attempt number: $1" >/dev/console + callnumber $PHONE1 +# callnumber $PHONE2 +} + +################################################################### +# +# Initialize the modem to ensure that it is in the command state +# +initialize +if [ ! "$?" = "0" ]; then + exit 1 +fi + +# +# Dial telephone numbers until one answers +# +attempt=0 +while : ; do + attempt=`expr $attempt + 1` + callall $attempt + if [ "$attempt" = "$MAX_ATTEMPTS" ]; then + exit 1 + fi + sleep "$SLEEP_DELAY" +done |