On Mon, Nov 22, 2004 at 04:12:52PM +0000 or so it is rumoured hereabouts,
Noel Donagh thought:
>> ----------
> Hi
> Has anyone got a login script for Mandrake for UTV Internet
> OR
> The settings to put into kppp GUI
>> I am not able to pass user-name password etc to complete connection
This is my chat script called by diald. I've hacked on it to use the
utvip backup number if the main one fails.
Conor
##########################################
#!/bin/sh
# Copyright (c) 1996, Eric Schenk.
#
# This script is intended to give an example of a connection script that
# uses the "message" facility of diald to communicate progress through
# the dialing process to a diald monitoring program such as dctrl or
diald-top.
# It also reports progress to the system logs. This can be useful if you
# are seeing failed attempts to connect and you want to know when and why
# they are failing.
#
# This script requires the use of chat-1.9 or greater for full
# functionality. It should work with older versions of chat,
# but it will not be able to report the reason for a connection failure.
# Configuration parameters
# The initialization string for your modem
#MODEM_INIT="ATZ&C1&D2%C0"
#MODEM_INIT="ATZ&C1&D2%C0X4M1L1W2"
MODEM_INIT="ATX4M1L3W2%TCB"
# The phone number to dial
PHONE_NUMBER="1893242242"
BACKUP_PHONE_NUMBER="135131890927750"
# The chat sequence to recognize that the remote system
# is asking for your user name.
#USER_CHAT_SEQ="name:--name:--name:--name:--name:--name:--name:"
USER_CHAT_SEQ="ogin--ogin--ogin--ogin--ogin--ogin--ogin"
# The string to send in response to the request for your user name.
USER_NAME="XXX"
# The chat sequence to recongnize that the remote system
# is asking for your password.
#PASSWD_CHAT_SEQ="word:"
PASSWD_CHAT_SEQ="assword"
# The string to send in response to the request for your password.
PASSWORD="XXXXXXX"
# The prompt the remote system will give once you are logged in
# If you do not define this then the script will assume that
# there is no command to be issued to start up the remote protocol.
#PROMPT="annex:"
#PROMPT="otocol"
# The command to issue to start up the remote protocol
#PROTOCOL_START="ppp"
PROTOCOL_START="ppp"
# The string to wait for to see that the protocol on the remote
# end started OK. If this is empty then no check will be performed.
#START_ACK="Switching to PPP."
#START_ACK="Switching to PPP."
# Pass a message on to diald and the system logs.
function message () {
[ $FIFO ] && echo "message $*" >$FIFO
logger -p local2.info -t connect "$*"
}
function repeat () {
# Change the phone number to dial
PHONE_NUMBER=$BACKUP_PHONE_NUMBER
message "Using backup number"
# Initialize the modem. Usually this just resets it.
message "Initializing Modem with "$MODEM_INIT
chat TIMEOUT 5 "" $MODEM_INIT TIMEOUT 45 OK ""
if [ $? != 0 ]; then
message "Failed to initialize modem"
exit 1
fi
# Dial the remote system.
message "Dialing system at "$PHONE_NUMBER
chat \
TIMEOUT 45 \
ABORT "NO CARRIER" \
ABORT BUSY \
ABORT "NO DIALTONE" \
ABORT ERROR \
"" ATDT$PHONE_NUMBER \
CONNECT ""
case $? in
0) message Connected;;
1) message "Chat Error"; exit 1;;
2) message "Chat Script Error"; exit 1;;
3) message "Chat Timeout"; exit 1;;
4) message "No Carrier"; exit 1;;
5) message "Busy"; exit 1;;
6) message "No DialTone"; exit 1;;
7) message "Modem Error"; exit 1;;
*)
esac
}
# Initialize the modem. Usually this just resets it.
message "Initializing Modem with "$MODEM_INIT
chat TIMEOUT 5 "" $MODEM_INIT TIMEOUT 45 OK ""
if [ $? != 0 ]; then
message "Failed to initialize modem"
exit 1
fi
# Dial the remote system.
message "Dialing system at "$PHONE_NUMBER
chat \
TIMEOUT 45 \
ABORT "NO CARRIER" \
ABORT BUSY \
ABORT "NO DIALTONE" \
ABORT ERROR \
"" ATDT$PHONE_NUMBER \
CONNECT ""
case $? in
0) message Connected;;
1) message "Chat Error"; exit 1;;
2) message "Chat Script Error"; exit 1;;
3) message "Chat Timeout"; exit 1;;
4) message "No Carrier"; exit 1;;
5) message "Busy"; repeat;;
6) message "No DialTone"; exit 1;;
7) message "Modem Error"; exit 1;;
*)
esac
# We're connected try to log in.
message "Logging in"
chat \
TIMEOUT 5 \
$USER_CHAT_SEQ \\q$USER_NAME \
TIMEOUT 45 \
$PASSWD_CHAT_SEQ $PASSWORD
if [ $? != 0 ]; then
message "Failed to log in"
exit 1
fi
# We logged in, try to start up the protocol (provided that the
# user has specified how to do this)
if [ $PROMPT ]; then
message "Starting Comm Protocol with "$PROTOCOL_START
chat TIMEOUT 15 $PROMPT $PROTOCOL_START
if [ $? != 0 ]; then
message "Prompt not received"
exit 1
fi
fi
if [ $START_ACK ]; then
chat TIMEOUT 15 $START_ACK ""
if [ $? != 0 ]; then
message "Failed to start Protocol"
exit 1
fi
fi
# Success!
message "Protocol started"
##########################################
--
Conor Daly <conor.daly at oceanfree.net>
Domestic Sysadmin :-)
---------------------
Faenor.cod.ie
9:22pm up 1:46, 1 user, load average: 0.25, 0.89, 0.70
Hobbiton.cod.ie
21:06:30 up 1:44, 1 user, load average: 0.00, 0.02, 0.14
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!