Thread: Dyndns & SSH
View Single Post
Posts: 729 | Thanked: 155 times | Joined on Dec 2009
#17
Originally Posted by Crocodile View Post
http://ipcheck.sourceforge.net/

Create file /etc/network/if-up.d/dyndns:
#!/bin/bash
cd /path/where/you/keep/pythonscript
python ipcheck.py -i gprs0 username password domain.dyndns.org

chmod 755 /etc/network/if-up.d/dyndns

First time, run manually:
python ipcheck.py --makedat -i gprs0 username password domain.dyndns.org
So it created it's data file.

And now you have autoupdating dyndns on the phone.. happy SSHing
I have modified your script so that it checks for the network interface and logs everything in a file. This works with GPRS and WLAN:
Code:
#!/bin/sh
interface=`ifconfig | grep -iE "(wlan0|gprs0)" | awk '{print $1}'`
echo "$(date) - $interface $ICD_CONNECTION_TYPE" >> /var/log/dyndns.log
sleep 10
echo "$(date) - $interface $ICD_CONNECTION_TYPE" >> /var/log/dyndns.log
cd /home/user/apps/
case "$interface" in
gprs0)
	while [ -z "$(ifconfig gprs0 | grep inet | awk '{print substr($2,6,length($2))}')" ] 
	 do
		echo "$(date) - No IP yet for gprs0" >> /var/log/dyndns.log
		sleep 2
	 done
	python ipcheck.py -v -i gprs0 USER PASSWORD DynDNSHOST >> /var/log/dyndns.log
	;;
wlan0)
	while [ -z "$(ifconfig wlan0 | grep inet | awk '{print substr($2,6,length($2))}')" ] 
	 do
		echo "$(date) - No IP yet for wlan0" >> /var/log/dyndns.log
		sleep 2
	 done
	python ipcheck.py -v -i wlan0 -r checkip.dyndns.org:8245 USER PASSWORD DynDNSHOST >> /var/log/dyndns.log
	;;
*)
	echo "$(date) - No interface found!" >> /var/log/dyndns.log
	;;
esac
echo " " >> /var/log/dyndns.log
exit 0
The only problem is that it doesn't work all the time. Please help me to find out if it is a bug on http://talk.maemo.org/showthread.php?p=453662

btw: Is the connection from the Python script secured or will my credentials transferred without any encryption?

Last edited by DaSilva; 2010-01-15 at 07:28.