Active Topics

 


Reply
Thread Tools
Posts: 6 | Thanked: 0 times | Joined on Jan 2008
#1
Hi,

I'm at a university where they require us to login every time we connect to the wifi. I was wondering if anyone knows how to get Maemo 2008 to run a script after connecting to a network. If I can get it to do this, I can just script the login process. Does anyone have any ideas?

Thanks in advance,

Alex Lowe
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#2
 

The Following User Says Thank You to qwerty12 For This Useful Post:
Posts: 6 | Thanked: 0 times | Joined on Jan 2008
#3
Excellent! Trying it out now.

Thanks for the quick reply!
 
Posts: 1,224 | Thanked: 1,763 times | Joined on Jul 2007
#4
If you want command line solution, there is dbus-scripts, which allows running a script on any dbus event, which includes connection or disconnection (either to a specific network, or to any network).
This package is available from chinook extras-devel, but works on diablo (and OS2007/OS2006) as well.

I actually use it to do exactly what you describe.
 

The Following User Says Thank You to Matan For This Useful Post:
Posts: 37 | Thanked: 9 times | Joined on Nov 2008
#5
In another direction, does you school support DeviceScape? Some do, and if so it works well, at least it does for me.
 
Posts: 12 | Thanked: 10 times | Joined on Jan 2008 @ Patra, Greece
#6
There is also the good old-fashioned manual way to do it:

Inside /etc/network directory there are four subdirectories.
You can put .sh scripts or symbolic links in each subdirectory as follows:

if-down.d - Script that will be executed after network has been disconnected
if-post-down.d - Script that will be executed before network disconnection
if-pre-up.d - Script that will be executed before network connection
if-up.d - Script that will be executed after network has been connected

Now here is a sample script that you can put inside e.g. if-up.d directory

#!/bin/bash

ssid=`iwgetid -s`

if [ $ssid == "my_network_ssid" ]
then
#put here the command to be executed only when connected
#on network "my_network_ssid"


 

The Following 3 Users Say Thank You to spiros For This Useful Post:
Posts: 35 | Thanked: 13 times | Joined on Oct 2008
#7
To complete this thread the following was used after installing wireless-tools. This allows running multiple user scripts from the MyDocs location. Found this an easier way keeping track / backups of the scripts while also allowing me to be lazy and use leafpad as editor.

in if-up.d/50_upscripts
Code:
#!/bin/sh
ssid=`iwgetid -s`
if [ -z $ssid ]; then
   exit
fi

if [ $ssid == "my_network_ssid" ]; then
   list=`ls /home/user/MyDocs/scripts/up_*.sh`
   for script in $list
   do
      /home/user/MyDocs/scripts/$script
   done
fi
in if-post-down.d/50_downscripts
Code:
#!/bin/sh
ssid=`iwgetid -s`
if [ -z $ssid ]; then
   exit
fi

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

Then create a folder /home/user/MyDocs/scripts/ and prefix your script up_***.sh or down_***.sh

With this ive created all the scripts needed to start/stop each time I go or leave home :-
..torrent automatically download and stop
..ftp daemon
..web daemon
..sound on / off
__________________
topsmileys - Free forum smileys

Last edited by purg; 2009-04-23 at 12:12.
 

The Following 2 Users Say Thank You to purg For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 18:38.