Active Topics

 


Reply
Thread Tools
spinnukur's Avatar
Posts: 569 | Thanked: 159 times | Joined on Sep 2009 @ District of Columbia
#11
Originally Posted by pagesix1536 View Post
Sounds like the way to go. I guess it didn't even cross my mind that the N900 on T-Mobile is probably NATed. Reverse SSH tunnel FTW. So honestly, dyndns isn't necessary on the N900, you're not going to connect to the N900 directly, but rather go through a webhost which would actually be the server needing a Dyndns client on it.
So something like this http://www.dyndns.com/ combined with Apache?
__________________
To find yourself, think for yourself

-Socrates 469 BC
 
Posts: 3 | Thanked: 12 times | Joined on Oct 2009 @ Varberg
#12
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
 

The Following 12 Users Say Thank You to Crocodile For This Useful Post:
Posts: 125 | Thanked: 67 times | Joined on Sep 2009 @ Finland
#13
I did just what Crocodile suggested, manual run worked nice, but booting up the device didn't work as I supposed it should have, dyndns didn't update. Also, is it possible to get the script update each time connection is re-established and the ip changes, not just when network comes up?
__________________
That that doesn't kill you, is going to hurt like hell. Or leave a scar.
I am not a coder, not a tablet heavy user, N900 is first one for me.
My only asset in here is cool head and common sense.
Stupidity is the thing I hate the most.
 
Posts: 31 | Thanked: 32 times | Joined on Jan 2008 @ Helsinki
#14
Originally Posted by Soulfarmer View Post
I did just what Crocodile suggested, manual run worked nice, but booting up the device didn't work as I supposed it should have, dyndns didn't update. Also, is it possible to get the script update each time connection is re-established and the ip changes, not just when network comes up?
Same here. The script does not seem to get run (running with -l creates no log file).
 

The Following User Says Thank You to kortsi For This Useful Post:
Posts: 125 | Thanked: 67 times | Joined on Sep 2009 @ Finland
#15
I had to change the first row

#!/bin/bash

to

#!/bin/sh

and then the script worked correctly. Don't know although does it work each time I disconnect gprs-connection. At least the shell-script works now.

EDIT: yeah, now it works like I think it should work. Really nice. Only dynds-domain to remember now. Thanks a LOT!
__________________
That that doesn't kill you, is going to hurt like hell. Or leave a scar.
I am not a coder, not a tablet heavy user, N900 is first one for me.
My only asset in here is cool head and common sense.
Stupidity is the thing I hate the most.
 

The Following 2 Users Say Thank You to Soulfarmer For This Useful Post:
Posts: 3,841 | Thanked: 1,079 times | Joined on Nov 2006
#16
Yup, yes, always always use #!/bin/sh for scripts that don't require bash-specific features. And try to avoid needing such features in the first place, if possible. #!/bin/bash isn't something script-writers should use as their default script heading.
__________________
N800/OS2007|N900/Maemo5
-- Metalayer-crawler delenda est.
-- Current state: Fed up with everything MeeGo.
 
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.
 
Posts: 27 | Thanked: 21 times | Joined on Jan 2010
#18
I played around with this and even created an installable package Check: http://maemo-experience.blogspot.com...e-on-n900.html

What I need now is a GUI to edit the values of dyndns hostname, username and password.
 
Posts: 729 | Thanked: 155 times | Joined on Dec 2009
#19
Which script have you used for this? Crocodiles version only with grps0 support or my version for grps0 and wlan0 support?
 
Posts: 27 | Thanked: 21 times | Joined on Jan 2010
#20
Originally Posted by DaSilva View Post
Which script have you used for this? Crocodiles version only with grps0 support or my version for grps0 and wlan0 support?
None of the above I actually wrote the script about a month ago when I got the phone - just threw it in a debian package (mostly because I wanted to figure out how to do that).

What I am currently doing is using ipcheck.py's built-in feature where it can query the external IP address.

It goes something like:

./ipcheck.py -l -r checkip.dyndns.org:8245 $DYNDNS_USER $DYNDNS_PASSWORD $DYNDNS_HOSTNAME

Anyway - the package should only install 3 files really:

/etc/ipcheckrc
/etc/network/if-up.d/ipcheck
/opt/ipcheck/ipcheck.py

/etc/ipcheckrc is empty by default and if a /home/user/.ipcheckrc exists - that one will be used instead.

But first I want to figure out how to hack a simple gui to configure the 3 necessary values from the GUI.
 

The Following User Says Thank You to lbthomsen For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 09:00.