Re: Skript um IP auf Webserver zu uppen

From: Oliver Fromme <olli(at)secnetix.de>
Date: Fri, 22 Aug 2003 17:42:26 +0200 (CEST)

Carsten <Carsten(at)hashba.de> wrote:
> 1. Wie kann ich die aktuelle IP per Skript herausfinden? bzw. wie kann ich s
> ie
> als Variable nutzen?

Also, in meinem dyndns-Skript [*] mache ich das so:

MYIP=$(ifconfig tun0 | awk '($1 == "inet" && $4 !~ "255$") {i = $2} END {print i}')

Danach steht die IP in $MYIP. Wenn Du dann in einer HTML-
Seite etwas dadurch ersetzen willst, hilft Dir sed. Zum
Beispiel sowas:

sed "s/<<<MYIP>>>/$MYIP/g" template.html > index.html

In der Datei template.html schreibst Du dann an den Stel-
len, wo die IP hingesetzt werden soll, <<<MYIP>>> hin.

> 2. Wo muss ich das Skript platzieren, oder was muss ich tun damit es bei jed
> er
> Neueinwahl ausgeführt wird?

/etc/ppp/ppp.linkup

Siehe die manpages und das Handbook. Da steht das ausführ-
lich drin.

Gruß
   Olli

[*] Normalerweise bekommst Du in ppp.linkup die jeweilige
IP bereits per »MYADDR«. Da ich mein dyndns-Skript aber
nicht nur in ppp.linkup benötige, verwende ich o.g. Shell-
Zeile, um die IP herauszufinden.

-- 
Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.
"IRIX is about as stable as a one-legged drunk with hypothermia
in a four-hundred mile per hour wind, balancing on a banana
peel on a greased cookie sheet -- when someone throws him an
elephant with bad breath and a worse temper."
        -- Ralf Hildebrandt
To Unsubscribe: send mail to majordomo.FreeBSD.org
with "unsubscribe de-bsd-questions" in the body of the message
Received on Fri 22 Aug 2003 - 17:43:25 CEST

search this site