In message <[EMAIL PROTECTED]>, John Conover writes:
> Is it possible to have alternate numbers in the diald/ppp/chat chat
> script like uucp, so if the first number fails, it will try the
> second?

Might as well post the one I use to the list.

Bob

#! /bin/bash

FIFO=/etc/diald/diald.ctl

# Norwalk     667-0050
# Long Beach  683-0050
# Anaheim     1-714-410-0050

phonelist="6670050 6830050 17144100050"

ok=0
scripterror=1
iosignal=2
timeout=3
busy=4
nocarrier=5
noanswer=6
nodialtone=7
error=8

# Pass a message on to diald and the system logs.
function message () {
[ $FIFO ] && echo "message $*" >$FIFO
        logger -p local2.info -t connect "$*"
}

for phone in $phonelist
do
        /usr/sbin/chat -r /var/log/diald.log  \
                ABORT BUSY \
                ABORT "NO CARRIER" \
                ABORT "NO ANSWER" \
                ABORT "NO DIALTONE" \
                ABORT ERROR \
                REPORT CONNECT \
                "" AT\&F1 \
                OK ATDT$phone \
                CONNECT "" \
                ogin:--ogin: <YOUR-NAME> \
                word: \\q<YOUR-PASSWORD>

        case $? in
                0 ) message "connected to $phone"
                        break
                ;;

                1 ) message "chat failed with a script error"
                        break
                ;;

                2 ) message "chat failed with an i/o error or a signal"
                        break
                ;;

                3 ) message "chat timed out on $phone"
                ;;

                4 ) message "chat returned BUSY on $phone"
                ;;

                5 ) message "chat returned NO CARRIER on $phone"
                ;;

                6 ) message "chat returned NO ANSWER on $phone"
                ;;

                7 ) message "chat returned NO DIAL TONE on $phone"
                ;;

                8 ) message "chat returned MODEM ERROR on $phone"
                        break
                ;;
        esac
done

exit $retval
+---------------------------------------------------------------+
| Bob Taylor             Email: [EMAIL PROTECTED]            |
|---------------------------------------------------------------|
| Like the ad says, at 300 dpi you can tell she's wearing a     |
| swimsuit. At 600 dpi you can tell it's wet. At 1200 dpi you   |
| can tell it's painted on. I suppose at 2400 dpi you can tell  |
| if the paint is giving her a rash. (So says Joshua R. Poulson)|
+---------------------------------------------------------------+

Reply via email to