A couple of PPP related questions

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


--ReaqsoxgOBHFXBhH
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=
he
> morning. I could do it by grepping PS for the PID but I wondered if there=
 was
> 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

    MYADDR:
      !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
al.

N
--=20
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 ---

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

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

iEYEARECAAYFAjr5ZpMACgkQk6gHZCw343WbJgCfa1fVqdnXJ/gLlNaXQcwkjy2M
KxkAn34SCAxGQWLDU6Rd/lyeThxVY2r1
=YnF0
-----END PGP SIGNATURE-----

--ReaqsoxgOBHFXBhH--




More information about the Ukfreebsd mailing list