A couple of PPP related questions

Nik Clayton nik at freebsd.org
Wed May 9 16:47:32 BST 2001

Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, May 09, 2001 at 03:52:58PM +0100, Neil Ford wrote:
> Question 1
> Is it possible to get PPP to write it's process ID out to a file? I want =
to be
> able to have a cron job kill the PPP process at night and restart it in t=
> morning. I could do it by grepping PS for the PID but I wondered if there=
> a more elegant solution.

Look at the bottom of the examples in pppctl(8), which show how you can
use a script from cron that calls pppctl to set up and tear down a dial
filter to prevent ppp from dialing out.  That's probably more elegant
than killing and restarting.

> Question 2
> Whats the best way to extract the dynamic IP address that's been allocate=
d to
> a machine by an ISP. I ideally want the machine to mail this detail out
> everytime it makes the connection.  You can probably guess where I'm going
> with this one :-)

A linkup script run from ppp.linkup that does something like

    ifconfig tun0 | grep inet | awk '{print $2}' | mail ...

In fact, reading ppp(8), I see that you can put this in ppp.linkup

      !bg /etc/ppp/linkup.sh MYADDR

and the /etc/ppp/linkup.sh script will have your IP addressed passed as
the first parameter, so there's no need to play games with ifconfig et

FreeBSD: The Power to Serve             http://www.freebsd.org/
FreeBSD Documentation Project           http://www.freebsd.org/docproj/

          --- 15B8 3FFC DDB4 34B0 AA5F  94B7 93A8 0764 2C37 E375 ---

Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.0.4 (FreeBSD)
Comment: For info see http://www.gnupg.org



More information about the Ukfreebsd mailing list