maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   Wifi switcher - what settings to start/stop via cmd line? (https://talk.maemo.org/showthread.php?t=46521)

slewis1972 2010-03-04 21:29

Wifi switcher - what settings to start/stop via cmd line?
 
Hi

I am wondering what the options are to stop and start wifi switcher via the command line?
Reason being, I have fcron installed and will then set a schedule task to start at x time and then to turn it off at x time. Could save me battery quite alot.

Scott

dsawhney 2010-03-04 21:52

Re: Wifi switcher - what settings to start/stop via cmd line?
 
if you've wifi-switcher installed, check /usr/sbin/wifi.sh

rooted 2010-03-05 10:40

Re: Wifi switcher - what settings to start/stop via cmd line?
 
in a nutshell:

Code:

#!/bin/sh
out=`ifconfig wlan0`
if [ $? -eq "0" ] ; then
if [ `echo "$out" | grep -c RUNNING` -gt "0" ] ; then
run-standalone.sh dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true
fi
ifconfig wlan0 down
rmmod wl12xx
run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:'Wi-Fi disabled'
exit 2
else
modprobe wl12xx
wl1251-cal
stop wlancond
start wlancond
ifconfig wlan0 up
run-standalone.sh dbus-send --print-reply --system --dest=com.nokia.icd_ui /com/nokia/icd_ui com.nokia.icd_ui.show_conn_dlg boolean:false
exit 0
fi

This script is extracted from Wi-Fi Switcher and enables or disables wi-fi. It can be used with fcron.

slewis1972 2010-03-06 17:52

Re: Wifi switcher - what settings to start/stop via cmd line?
 
I get error
./wifiswitcher: line 3: syntax error: end of file unexpected (expecting "then"

When I try and run it.

Scott

rooted 2010-03-06 18:54

Re: Wifi switcher - what settings to start/stop via cmd line?
 
Try again with sh script.sh and also verify that the script was copied correctly. The script also needs chmod +x and be run as root.

slewis1972 2010-03-06 19:21

Re: Wifi switcher - what settings to start/stop via cmd line?
 
Ok - resolved, error in my copy and paster.


All times are GMT. The time now is 19:42.

vBulletin® Version 3.8.8