[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Gestion cnx Adsl



Dans son message du 18/2/2002, "Tony Schonfeld (f5git)" écrivait:

> Bonjour a tous , 

Hi,

> ...
> #!/bin/sh
> update.dns
> sleep 600
> /etc/init.d/apache restart

Du temps ou j'avais une adresse IP dynamique et des VirtualHost
dans Apache, je faisais un truc comme ca dans un script
/etc/ppp/ip-up.d/20ddns  :

#!/bin/sh
HTTPDCONF="/etc/apache/httpd.conf"
OLDIP=`cat /root/adsl.ip`;
NEWIP=`ifconfig ${PPP_IFACE} 2>/dev/null|grep 'inet addr'|sed -e 's/^[^:]*://' -e 's/[  ].*//'`
if [ ${OLDIP} != ${NEWIP} ];then
# Modifier l'enregistrement chez DynDNS
  /usr/sbin/ddns --modify --address=${PPP_LOCAL}
  if [ $? -eq 0 ];then
    logger -t ddns "successfully updated from ${OLDIP} to ${NEWIP}"
    echo ${NEWIP} > /root/adsl.ip
  else
    logger -t ddns "update failed. [$?]"
  fi
# Modifier les VirtualHost et relancer Apache
  mv ${HTTPDCONF} ${HTTPDCONF}.${OLDIP}
  sed -e "s/${OLDIP}/${NEWIP}/" ${HTTPDCONF}.${OLDIP} > ${HTTPDCONF}
  /etc/init.d/apache reload
else
  logger -t ddns "update not needed."
fi


Didier



Reply to: