maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   OS2008 / Maemo 4 / Chinook - Diablo (https://talk.maemo.org/forumdisplay.php?f=29)
-   -   Detect home WIFI > run command (https://talk.maemo.org/showthread.php?t=28162)

purg 2009-04-08 15:24

Detect home WIFI > run command
 
Ive been wanting to run a few commands each time I enter / leave my home WIFI.

I use my N800 as a pocket server for various apps. For security I would like to automatically start/stop daemons when in or out of home.

Ive already written start/stop scripts (placed under osso-statusbar-cpu) for ease but would like to automate this. Been looking at dbus-monitor but thats where ive hit my technical wall of the device.

Any suggestions how a command could be run when a known WIFI becomes active / deactivated?


Cheers

qwerty12 2009-04-08 15:27

Re: Detect home WIFI > run command
 
http://maemo.org/downloads/product/OS2008/conler/

Or you could try Matan's dbus-scripts-settings which is in Extras I believe.

Matan 2009-04-08 15:36

Re: Detect home WIFI > run command
 
dbus-scripts does that (available on extras repository). Just install this package, find the id of your network by looking at the output of

gconf -R /system/osso/connectivity/IAP

and create a file in /etc/dbus-scripts.d/ containing the lines:
/connectscript * * com.nokia.icd * network_id * CONNECTED
/disconnectscript * * com.nokia.icd * network_id * IDLE

(replacing network_id with the correct id and /connectscript with correct path of the script you want to run on connect.)


In extras-devel there is a package called dbus-scripts-settings which allows doing these things using a GUI.

spiros 2009-04-08 18:21

Re: Detect home WIFI > run command
 
There is also the old fashioned way by using just shell scripts.

Check here: http://www.internettablettalk.com/fo...832#post259832

purg 2009-04-08 20:40

Re: Detect home WIFI > run command
 
I didnt expect this many options to toy with. Thanks for the replies, will take a look tonight and update tomorrow.

purg 2009-04-08 21:15

Re: Detect home WIFI > run command
 
conler .... for some reason didnt install, stuck on the prepare screen.

dbus-scripts .... installed because it looks helpful

manual method .... Thanks spiros this was the method I went for. All the scripts ive written fit very well with /etc/network. Cheers for the link and script snippet. For my needs ive posted my simple edit to exec all scripts within dir.

Code:

#!/bin/ksh
ssid=`iwgetid -s`

if [ $ssid == "my_network_ssid" ]
then
cd /home/user/MyDocs/scripts
list=`ls *.sh`
for script in $list
do
  $script
done


Thesandlord 2009-04-09 01:52

Re: Detect home WIFI > run command
 
Conler + Wake on Lan + x10 = cool....


All times are GMT. The time now is 16:23.

vBulletin® Version 3.8.8