Ishaaq K Chandy wrote:

> I've finally made a chat script that allows me to dial-up my ISP from a
> modem connected to the server, from a telnet session on a remote machine. The
> only problem is that I don't know for sure until I do a netstat -nr if I am
> connected. 
> 
> Is there some way to get the script to periodically check the modem until it
> detects a CONNECT signal and then at that point to give a beep on the remote
> computers' speaker? After which again it waits for the login procedure to get
> over and as soon as ppp is up again another beep.

The first couple of steps would be awkward, as pppd just runs chat (or
whatever you specified as an argument to the connect option), and
waits for it to finish. You could use `expect' instead of chat; this
would allow you to execute commands at various points.

The last step (notifying you when PPP is up and running) is
straightforward, as pppd runs the /etc/ppp/ip-up script at this point.
If you are starting pppd from a script, you can make the script sleep
until the ip-up script signals it. E.g. if you have an `online' script 
similar to the following:

        #!/bin/sh

        echo Connecting...

        /usr/sbin/pppd <arguments>
        
        if [ $? != 0 ] ; then
            echo *** pppd failed ***
            exit
        fi
        
        echo Waiting for PPP ...
        
        trap "break" SIGCONT
        while true ; do
                echo -n .
                sleep 1
        done
        trap SIGCONT
        
        echo
        echo Online ...

you can put

        killall -CONT online

in your ip-up script. The `online' script will wait until the ip-up
script sends it SIGCONT before continuing.

> I have a feeling this is too tall an order, I think the telnet service may not
> allow this.

It depends upon whether your telnet client recognises \007 (Ctrl-G) as
a beep. If it does,

        echo -e '\007'

will send a beep.

> Another way to do this would be to find out the name of the machine
> to whom the telnet session belongs and to send a Winpopup message. 
> Again how?

telnetd may set the HOSTNAME variable to the remote host. 
Alternatively, you can use `tty' to get the name of the tty device,
and `w' to get the remote host. You can use `smbclient -M ...' to send
a WinPopup message.

-- 
Glynn Clements <[EMAIL PROTECTED]>
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]

Reply via email to