INTRODUCTION

This is a program to manage incoming SMS messages to a Nokia mobile phone
permanently connected to a PC with gnokii installed, executing programs
according to commands in the SMS'es if supplied password and the sending
number is correct -- in the purpose of connecting your home network to the
Internet remotely.

CONFIGURATION

Put a gnokline.cfg in gnokline's directory, containing something like:

[DEFAULT]
number=+4790000000
up=~/zyxel/myzyxel wolg >/dev/null 2>&1
down=~/zyxel/myzyxel empty >/dev/null 2>&1
lockfile=gnokline.lock
logfile=gnokline.log
password=XXXX
gnokiips=/bin/ps auxww | grep gnokii | grep -v grep
killgnokii=/usr/bin/killall -9 gnokii
gnokiittl=15
loopwait=20

Where:

number= The number you permit to send the SMS'es with commands.

up= The shell command to execute to "get your home network online". For me
that is to execute a script that configures my ISDN router with the setup for
my favourite ISP (done with an expect script) and running some ping commands
to make it actually dial. This could just as well be starting up a ppp process
in an automized background mode, or whatever you need to do to get online.

down= The shell command to execute to "disconnect your home network". For me
that is to execute a script that configures my ISDN router with an empty
setup. This could just as well be killing a(ll) ppp process(es), or whatever
you need to do to make sure your home network won't stay connected.

lockfile= The lock filename for Gnokline to write if you send an SMS lock
command to stop the whole service. You'll have to manually remove it before
you restart Gnokline again.

logfile= The logfile for Gnokline to log its actions.

password= The password that will need to be sent together with the SMS for
Gnokii to actually perform the commands.

gnokiips= The shell command to print running gnokii processes. Must present
them with their PID in the left-most column.

killgnokii= The shell command to execute to kill any running gnokii process.

gnokiittl= How long to let Gnokii processes live. A sub-process will be forked
to monitor running gnokii processes. If it sees the same between this many
seconds, it'll kill it.

loopwait= The number of seconds for Gnokline to wait between the rounds of
checking all SMS messages on the phone.

USAGE

Start Gnokline:

# ./gnokline.py

And hide the shell or put the process in the background. Obviously, this must
be on the same machine having the Nokia phone connected.

Then send SMS messages of the following types to the phone that is connected
on your home network:

gnokline up <password>
(Which should bring your home network online.)

gnokline down <password>
(Which should take your home network offline.)

gnokline lock <password>
(Which should stop the gnokline service.)

And then, after a successful up command, if you've configured your home
network and gnokii/gnokline properly, you should be able to access it remotely
by ssh or whatever method you prefer. :-)

REQUIREMENTS

Python -- http://www.python.org/
Gnokii -- http://www.gnokii.org/

Gnokii must be compiled with the proper port configured. You also need a spare
Nokia phone that is compatible with the installed gnokii program.

LINKS

http://www.zyxel.com/ -- great ISDN routers.

DISCLAIMER

See top of gnokline.py.

AUTHOR

Name: Anders Nordby
Web: http://anders.fix.no/
E-mail: anders@fix.no

