Notices


Reply
Thread Tools
Posts: 1,680 | Thanked: 3,685 times | Joined on Jan 2011
#1
Smart mail checking alarmd script

This is a fairly simple script that will sync your email. It can be set to run hourly etc. with crom/alarmd etc.

The thng that makes this script special is that it will put your wifi back to the way it is when it is run.

For example there are 3 possibilities. 1. wifi is already connected, 2 wifi kernel modules loaded, kernel modules not loaded. This script will detect one of the three possibilities, take appropriate action (load modules, connect etc) then return your wifi back to it's original setting (unloaded, not connect, connected).

It can be run with:

Code:
echo "/path/to/script.sh" | sudo gainroot | echo ""
and the script:

Code:
#!/bin/sh
#smart email check script
out=`ifconfig wlan0`
if [ $? -eq "0" ] ; then
	if [ `echo "$out" | grep -c RUNNING` -gt "0" ] ; then
		echo "wifi connected, checking mail"
		run-standalone.sh dbus-send --type=method_call --dest=com.nokia.modest /com/nokia/modest com.nokia.modest.SendReceive

	else
		echo "wifi disconnected, connecting..."
		sleep 2
		run-standalone.sh dbus-send --system --type=method_call --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:"[ANY]" uint32:0
		sleep 15
		run-standalone.sh dbus-send --type=method_call --dest=com.nokia.modest /com/nokia/modest com.nokia.modest.SendReceive
		echo "checking mail"
		sleep 55
		dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true | echo ""
	fi	
	exit 2

	else
		echo "wifi modules unloaded, bringing up"
		modprobe wl12xx
                wl1251-cal
                stop wlancond
                start wlancond
                ifconfig wlan0 up

		sleep 1
		dbus-send --system --type=method_call --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:"[ANY]" uint32:0 | echo ""
		sleep 7
		run-standalone.sh dbus-send --type=method_call --dest=com.nokia.modest /com/nokia/modest com.nokia.modest.SendReceive
		echo "checking email"
		sleep 35
		ifconfig wlan0 down
                rmmod wl12xx

	exit 0
fi
unfortunatley you need to have modest 'autoupdate' enabled for it to respond to the syncemail dbus call (which totally sucks btw). I have simply editited the modest.conf autocheck time value to 999999.

Seems to work!
 

The Following 3 Users Say Thank You to vi_ For This Useful Post:
Posts: 7 | Thanked: 6 times | Joined on Apr 2010 @ outOnTheFields
#2
Hello,

can you please advice where can i locate the modest.conf file?
I was able to find one modest.conf file under

etc/osso-backup/applications/modest.conf
the content of the file looks like this:
<backup-configuration>
<locations>
<location type="file" category="comm_and_cal" auto="true">$HOME/.modest-backup.tar.gz</location>
<location type="dir" category="comm_and_cal" auto="true">/var/lib/gconf/apps/modest</location>
</locations>
</backup-configuration>
I'm not sure how i should define the "autoupdate" value. Please help me locate the correct modest.conf file.

Thank you
-Michal.

Last edited by miskooldfield; 2011-01-10 at 18:33. Reason: fixed mistakes in the file path provided
 
Posts: 992 | Thanked: 738 times | Joined on Jun 2010 @ Low Earth Orbit
#3
modest config is stored in that POS gconf:

Code:
gconftool-2 -R /apps/modest | less
 

The Following User Says Thank You to kureyon For This Useful Post:
Posts: 7 | Thanked: 6 times | Joined on Apr 2010 @ outOnTheFields
#4
thanks a lot kureyon,

just in case, here is what i did, with my comments; as i used gconftool-2 for the first time:
i've checked the update_interval value
>gconftool-2 -g /apps/modest/update_interval
1440
i found what kind of type this one is (probably obvious to most of you guys):
gconftool-2 -T /apps/modest/update_interval
int
so i've set it to 999999
>gconftool-2 -s /apps/modest/update_interval --type int 999999
and ...double checked
>gconftool-2 -g /apps/modest/update_interval
999999
again, thanks for giving me a heads up on this.

modest is now responsive to the dbus calls, as adviced

-M.
 

The Following User Says Thank You to miskooldfield For This Useful Post:
Posts: 13 | Thanked: 5 times | Joined on Apr 2010
#5
Originally Posted by vi_ View Post
unfortunatley you need to have modest 'autoupdate' enabled for it to respond to the syncemail dbus call (which totally sucks btw). I have simply editited the modest.conf autocheck time value to 999999.
Ah, now I know why my own scripts have never worked! Thanks!
 
Posts: 427 | Thanked: 160 times | Joined on Nov 2009
#6
is this anything close to imap idle? can you set it to check every minute or would it tax the n900 too much?
__________________
Please vote for the following bug:
Media player should play audio tracks continuously (gapless playback)
 
Posts: 1,680 | Thanked: 3,685 times | Joined on Jan 2011
#7
You could set it to check every minute however Modest is such ball smoking crap you would probably be issuing multiple email syncs at once.
 
Reply


 
Forum Jump


All times are GMT. The time now is 02:04.