Active Topics

 


Reply
Thread Tools
Posts: 18 | Thanked: 0 times | Joined on Jan 2010
#1
Yesterday I installed alarmed (from extras-dev). Now i'd like to use it, amongst other things, to let gPodder download new podcasts at night.
I already found out that i can do this with
Code:
gpo update && gpo download
However, since i have a very limited 3G plan, i'd like to add a check to make sure that this is only executed when connected to wi-fi. Could somebody point me in the right direction on how i can check this? The only thing i can come up with is to do something like
Code:
sudo ifconfig wlan0 | grep <something>
to check if the wlan0 interface has an ip-address, but that seems rather hackish to me.

thx!
 
calvin_42's Avatar
Posts: 286 | Thanked: 219 times | Joined on Feb 2010 @ France
#2
Code:
[[ -n `cat /proc/net/route | grep wlan0` ]] && gpo update && gpo download
should work pretty good.
__________________
AutoDisconnect automatically closes your idle connections (Wifi/3G/Bluetooth) and switches the network mode to 2G when 3G is not used. [ Thread ] [ Wiki ] [ Donate ]
 

The Following User Says Thank You to calvin_42 For This Useful Post:
Posts: 18 | Thanked: 0 times | Joined on Jan 2010
#3
Originally Posted by calvin_42 View Post
Code:
[[ -n `cat /proc/net/route | grep wlan0` ]] && gpo update && gpo download
should work pretty good.
You command seems to always return true and execute the second command. However by reading about the '-n ' in bash, i came up with the following which seems to work:

Code:
test=`cat /proc/net/route | grep wlan0`
[[ -n "$test" ]] && gpo update && gpo download
Thx for the help!
 
Reply


 
Forum Jump


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