View Single Post
Posts: 22 | Thanked: 19 times | Joined on Nov 2009
#21
Oh, I see, that would be easy to check though, can update the script in a little while (to check for external connection), however that might not always be desired?

It doesn't sound too hard to start a reverse port forward if there exists a file on the server, however it might take a while for the phone to recognize the file considering it only checks for it when a new connection is established. Could be crontabed though.

Just on a side note, the N900 and the SSH server does per default accept connections even on the gprs0 interface? I'm having some troubles connecting but my ISP claims they don't block any ports :/

Edit: I beleave I just have to add the following line to the file, though i have not tested it..

Code:
if [ "$ICD_CONNECTION_TYPE" != GPRS ]; then
        exit 0
fi
So in the end the file /etc/network/if-up.d/10_send_ip would look like this

Code:
#!/bin/sh

if [ "$ICD_CONNECTION_TYPE" != GPRS ]; then
        exit 0
fi
SERVER_HOST=host.to.server.org
LOGGFILE=n900_ip_logg
ip=`ifconfig gprs0 | awk '/inet addr/ { print $2 }' | awk -F: '{ print $2 }'`
ssh -F /home/user/.ssh/config $SERVER_HOST "echo `date` $ip >> $LOGGFILE"

Last edited by ecksun; 2010-03-15 at 16:39.
 

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