Active Topics

 


Reply
Thread Tools
Posts: 1,313 | Thanked: 2,978 times | Joined on Jun 2011 @ Finland
#1491
Originally Posted by Garp View Post
Ups! I have no script so now be aware in Suomi there will come a really stupid question:

Which script in this case?
In Custom Action like this:

Code:
sh /home/user/scripts/execroot.sh "/sbin/initctl restart xsession/icd2"
I didn't check where exactly you have execroot.sh etc., but I hope you get the gist of it.
__________________
My N9/N950 projects:
 

The Following User Says Thank You to ajalkane For This Useful Post:
Posts: 697 | Thanked: 137 times | Joined on Jul 2012 @ Hillerød, DK
#1492
Originally Posted by ajalkane View Post
In Custom Action like this:

Code:
sh /home/user/scripts/execroot.sh "/sbin/initctl restart xsession/icd2"
I didn't check where exactly you have execroot.sh etc., but I hope you get the gist of it.
Thanks and the path to execroot is correct but still only Blue Bar and nothing happens. Shouln't it restart the network with this action when condition is No net connection?
__________________
OK
 
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#1493
Garp, use custom action:
Code:
sh -c "echo rootme | devel-su -c '/sbin/initctl restart xsession/icd2'"
Change rootme to your root pass.

Last edited by Schturman; 2013-09-11 at 00:05.
 

The Following User Says Thank You to Schturman For This Useful Post:
Posts: 697 | Thanked: 137 times | Joined on Jul 2012 @ Hillerød, DK
#1494
Originally Posted by Schturman View Post
Garp, use custom action:
Code:
sh -c "echo rootme | devel-su -c '/sbin/initctl restart xsession/icd2'"
Change rootme to your root pass.
Thanks! seems to work when use Test button - updates net connection but only if it's set to Automatic and not Manual
__________________
OK

Last edited by Garp; 2013-09-11 at 10:56.
 
Posts: 1,313 | Thanked: 2,978 times | Joined on Jun 2011 @ Finland
#1495
Uploaded a minor update to Ovi Store (already available from OpenRepos).

Changelog:

* Wrapping of topic in time dialog (some translations need this)
* Up-to-date translations: Catalan
* Building for desktop target without rumbe-effect for ease of development
__________________
My N9/N950 projects:
 

The Following 4 Users Say Thank You to ajalkane For This Useful Post:
Posts: 25 | Thanked: 14 times | Joined on Sep 2013 @ Serbia
#1496
Hi to all, I read the entire topic and I need your help.
I'd like to make a "firewall" script that will periodically execute ("Time interval" option in ProfilMatic). The idea is to automatically close an open Internet connection using mcetool, unless it is opened by an application from the whitelist.
Why to make this script? Because I noticed that my N9 does not close the wifi connection after some applications... like store app, or availability (when turn it off) for exaple. I hope to save some battery time with this script. For me it's not appropriate to close the connection when I go to idle satus (even after some time)... so I wish to drop connection only if it's not in use by some app that I start.
I have an idea but not the knowledge to make it. So I need your expertise... and this is good opportunity to learn something new.

The script should check does any of applications from the (white) list currently running... And that's the part I do not know how to do...
If an application from the list running script should ends if not, the script will execute the commands:

Code:
/sbin/mcetool --disable-radio=wlan
sleep 1
/sbin/mcetool --enable-radio=wlan
Manually I can check running applications from terminal with "top" command... but that doesn't help me at all. I also try list all running apps with "ps aux" command, to find full name for process/app I want on my withe/exception list. But I have there problem too, for example:
I want firewall exception for availability set online (for any account) and I find telepathy in app list even I turn off availability.
So first problem is to determine full name of right process. How?
And second I dont know what bash variables should use in script... if I can use them at all.
My sketch is to use conditional statement like:

Code:
PROCESS=myapp
number=$(ps aux | grep $PROCESS | wc -l)
if [ $number -gt 1 ]
	then
		exit
	else
		#Disable Network (WiFi+3G/2G) connection
		gconftool-2 -t bool -s /system/osso/connectivity/network_type/restricted_mode true
		/sbin/mcetool --disable-radio=wlan
		sleep 1
		/sbin/mcetool --enable-radio=wlan
		exit
fi
And my withe list should be like this:
Code:
#Firewall exception AppList:

	#when availability for any account set online
	#eMail demon
	#Web browser
	#Firefox
	#Facebook
	#Twitter
	#QNeptunea
	#Skype
	#Wazapp
	#Foursquare
	#SkyFiles
	#Dropbox
	#Store
	#Soundwave
	#TranslateAll
Notice that I am a very novice, willing to learn but sometimes I need more detailed explanation.
Thank you.

Last edited by vds; 2013-09-19 at 16:22.
 

The Following User Says Thank You to vds For This Useful Post:
Posts: 25 | Thanked: 14 times | Joined on Sep 2013 @ Serbia
#1497
If anyone's interested, I managed to make a script that does exactly what I wanted. Script will disable WiFi/3G/2G connection, if any of the programs in the list of exceptions not in use.

Code:
#!/bin/bash
#Name=Firewall Network (WiFi+3G/2G) connection when not in use by applications from list

#Firewall exception AppList:
#	availability for profiles skype/fb
#	Web browser
#	Firefox/fennec
#	QNeptunea
#	Skype
#	Wazapp
#	Foursquare
#	SkyFiles
#	Ovi Store
#	Soundwave
#	TranslateAll
#	DropBox /DropN9/
#	DropBox /Dropian/

for PROCESS in [telepathy]-spirit [telepathy]-gabble [Qt]Web [f]ennec [QN]eptunea [wa]zapp [F]oursquare [Sky]Files [ovi]storeclient [quick]flicker [Sound]wave [T]ranslateAll [d]ropn9 [Dr]opian [we]bupload
do num=$(ps ax | grep -c -i $PROCESS)
	if [ $num -gt 0 ]
	then
		exit
	fi
done

#Disable Network (WiFi+3G/2G) connection
		gconftool-2 -t bool -s /system/osso/connectivity/network_type/restricted_mode true
		/sbin/mcetool --disable-radio=wlan
		sleep 1
		/sbin/mcetool --enable-radio=wlan
		exit
I also found that after some application (OviStore, Wazapp,Facebook app) process libcd_network_ipv4.scr does not turn off and that is reason why my WiFi connection remains open.

Stopping libcd_network_ipv4.scr process can be done in a simple script that will identify the pid and kill the process (to do this you must be root, so use ajalkane script from here: http://talk.maemo.org/showpost.php?p...&postcount=884):
Code:
ps ax | grep [libicd]_network_ipv4 | awk '{print $1}' | xargs kill -9
Stopping this process will eventually lead to the closure of open connections, so I used the above-mentioned command in previous script instead mcetool method and for me it works perfectly.
Once again I must remind that before running this edit script yu must first be logged in as root, or you can use http://talk.maemo.org/showpost.php?p...&postcount=884 script. That's because I did not know how to iculde command for root access in this script.
So one more time if you whant to use this one in ProfilMatic, maybe the best idea:
Code:
sh /home/user/scipts/execroot.sh "sh /home/user/scripts/kill_ipv4.sh"
Assuming that you copied the scripts in folder /home/user/scripts and that you named scipts execroot and kill_ipv4

EDIT kill_ipv4 script:
Code:
#!/bin/bash
#Name=Terminate (WiFi+3G/2G) connection when not in use by applications from list

#Firewall exception AppList:
#	availability for profiles skype/fb
#	Web browser
#	Firefox/fennec
#	QNeptunea
#	Skype
#	Wazapp
#	Foursquare
#	SkyFiles
#	Ovi Store
#	Soundwave
#	TranslateAll
#	DropBox /DropN9/
#	DropBox /Dropian/

for PROCESS in [telepathy]-spirit [telepathy]-gabble [Qt]Web [f]ennec [QN]eptunea [wa]zapp [F]oursquare [Sky]Files [ovi]storeclient [quick]flicker [Sound]wave [T]ranslateAll [d]ropn9 [Dr]opian [we]bupload
do num=$(ps ax | grep -c -i $PROCESS)
	if [ $num -gt 0 ]
	then
		exit
	fi
done

# kill network_ipv4 process

ps ax | grep [libicd]_network_ipv4 | awk '{print $1}' | xargs kill -9

Last edited by vds; 2013-09-23 at 11:57.
 

The Following 3 Users Say Thank You to vds For This Useful Post:
Posts: 25 | Thanked: 14 times | Joined on Sep 2013 @ Serbia
#1498
Originally Posted by ajalkane View Post
Uploaded a minor update to Ovi Store (already available from OpenRepos).
Greate, Thanks

Maybe an idea for further development of the already excellent application:
Is it possible to make that a condition for action is the availability of WiFi network (instead that connectivity with WiFi must be achieved)? The device can scan wifi network availability (in a certain time interval -either predefined or user can define it in app) and if the range of the known network, it can trigger actions (no need for WiFi to be connected to do that).
 
Posts: 1,313 | Thanked: 2,978 times | Joined on Jun 2011 @ Finland
#1499
Originally Posted by vds View Post
Greate, Thanks

Maybe an idea for further development of the already excellent application:
Is it possible to make that a condition for action is the availability of WiFi network (instead that connectivity with WiFi must be achieved)? The device can scan wifi network availability (in a certain time interval -either predefined or user can define it in app) and if the range of the known network, it can trigger actions (no need for WiFi to be connected to do that).
It is possible. But it is quite a bit of work to do and test. So I'm not sure if/when I'll do it. It's an old request and I've written it down, but no promises there.
__________________
My N9/N950 projects:
 
Posts: 1,313 | Thanked: 2,978 times | Joined on Jun 2011 @ Finland
#1500
Originally Posted by vds View Post
If anyone's interested, I managed to make a script that does exactly what I wanted. Script will disable WiFi/3G/2G connection, if any of the programs in the list of exceptions not in use.
Thank you for the revised version! I have added this post to the recipes section of the first post.
__________________
My N9/N950 projects:
 
Reply


 
Forum Jump


All times are GMT. The time now is 20:31.