I came up with a solution: Write a script that wont use a any extra programs that already i dont have.
EDIT: after som complains from a friend i rewrote the script to fit into "gentoo standard" better..
So here is the new script
Code: Select all
#!/bin/sh
# $1 file containing the following information
################################################
# Username Password Eth Dns Wildcard System #
################################################
# Eth #[eth*] Ethernet device to use
# LIP #[NOT ENTERED BY USER] Last IP
# CIP #[NOT ENTERED BY USER] Current IP
# Dns #[myhost.dyndns.org] Dynamic address
# Username #[Username] Dyndns username
# Password #[Password] Dyndns password
# Wildcard #[ON|OFF|NOCHG] Enable *.mydomain.dyndns.org
# MXHost #[mailexchanger|NOCHG] MX server
# MXBackup #[YES|NO|NOCHG] Backup MX server
# System #[dyndns|statdns|custom] DNS provider
TmpRcode="/tmp/dyndns_rcode"
TmpConf="/tmp/dyndns_config"
IPLog="/tmp/dyndns_ip"
if ! [ -e $1 ] ; then
echo "Specified config file does not exist."
exit 1
fi
source $1
if [ -z $MXHost ] ;then
MXHost="NOCHG"
fi
if [ -z $MXBackup ] ;then
MXBackup="NOCHG"
fi
if [ -z $Wildcard ] ;then
Wildcard="NOCHG"
fi
if [ -z $System ] ; then
echo "system missing..."
exit 1
fi
if [ -z $Eth ] ; then
echo "eth missing..."
exit 1
fi
if [ -z $Dns ] ; then
echo "dns missing..."
exit 1
fi
if [ -z $Username ] ; then
echo "username missing..."
exit 1
fi
if [ -z $Password ] ; then
echo "password missing..."
exit 1
fi
if ! [ -e $IPLog ] ; then
touch $IPLog
fi
LIP=`cat $IPLog | grep $Dns= | cut -d "=" -f 2`
CIP=`/sbin/ifconfig $Eth | grep "inet addr" | cut -d ":" -f 2 | cut -d " " -f 1`
if [ "$CIP" != "$LIP" ] ; then
wget -q --no-check-certificate -O $TmpRcode "https://$Username:$Password@members.dyndns.org/nic/update?system=$System&hostname=$Dns&myip=$CIP&wildcard=$Wildcard&mx=$MXHost&backmx=$MXBackup&offline=NO"
RCODE=`cat $TmpRcode | grep " " | cut -d " " -f 1`
if [ "$RCODE" = "badsys" ] ; then
echo "################################################################################"
echo "#Invalid service provider specified #"
echo "################################################################################"
exit 1
fi
if [ "$RCODE" = "!donator" ] ; then
echo "################################################################################"
echo "#PAY YOUR BILLS !!!!!!!! #"
echo "################################################################################"
exit 1
fi
if [ "$RCODE" = "nochg" ] ; then
echo "################################################################################"
echo "#WARNING, Unneeded update of IP, repeting this might lead to a canceled account#"
echo "################################################################################"
fi
if [ "$RCODE" = "badauth" ] ; then
echo "################################################################################"
echo "#Password or username is incorret #"
echo "################################################################################"
exit 1
fi
if [ "$RCODE" = "notfqdn" ] ; then
echo "################################################################################"
echo "#Not a qualified hostname #"
echo "################################################################################"
exit 1
fi
if [ "$RCODE" = "nohost" ] ; then
echo "################################################################################"
echo "#No such hostname exists#"
echo "################################################################################"
exit 1
fi
if [ "$RCODE" = "!yours" ] ; then
echo "################################################################################"
echo "#No such host in YOUR account #"
echo "################################################################################"
exit 1
fi
if [ "$RCODE" = "numhost" ] ; then
echo "################################################################################"
echo "#To many or to few hosts specified #"
echo "################################################################################"
exit 1
fi
if [ "$RCODE" = "abuse" ] ; then
echo "################################################################################"
echo "#Your account is blocked because of update abuse #"
echo "################################################################################"
exit 1
fi
if [ "$RCODE" = "dnserr" ] ; then
echo "################################################################################"
echo "#DNS error #"
echo "################################################################################"
exit 1
fi
if [ "$RCODE" = "911" ] ; then
echo "################################################################################"
echo "#Server problems, check your DNS providers homepage #"
echo "################################################################################"
exit 1
fi
if [ "$RCODE" = "" ] ; then
echo "################################################################################"
echo "#No respons from server #"
echo "################################################################################"
exit 1
fi
if [ -z $LIP ] ; then
echo "$Dns=0.0.0.0" >> $IPLog
fi
cat $IPLog > $TmpConf
sed -e s/^$Dns=.*/$Dns=$CIP/g $TmpConf > $IPLog
fi
Code: Select all
Dns=test.ath.cx
Eth=eth1
Username=test
Password=test
System=dyndns
Wildcard=ON
Code: Select all
Bash# /PATH/SCRIPT /PATH/CONF
And a little tip is to put these files somwhere safe and link to them from your dhcpcd execute script "<ConfigDir>/dhcpcd.exe".
Then you have created a permanently automatical update wich does not get your account blocked
EDIT:
********************************************************
Example of singel host: /etc/dhcpc/dhcpcd.exe
Code: Select all
/var/updatedns/updatedns /var/updatedns/test.ath.cx
Example of multiple hosts: /etc/dhcpc/dhcpcd.exe
Code: Select all
/var/updatedns/updatedns /var/updatedns/test.ath.cx
/var/updatedns/updatedns /var/updatedns/test.dyndns.org

