Run this every 1 minute (or whatever) with Alarmed. Seems to sync all e-mail accounts.
#!/bin/sh
secsbetween=600 #Only run if 10 minutes has passed since last update
maxload=40 #Only run if 5 min average load less than 0.40
if [ -s /tmp/prevmail.tmp ]
then prev=`cat /tmp/prevmail.tmp`
else prev=0
fi
cur=`date +%s`
if [ $(( $cur - $secsbetween)) -gt $prev ]; then
echo Time passed
load=`uptime|cut -d "," -f 4|tr -d " ."`
echo Load $load
if [ $load -lt $maxload ] ; then
echo Load low enough
#Uncomment to display a message when updating
# run-standalone.sh dbus-send --type=method_call\
--dest=org.freedesktop.Notifications\
/org/freedesktop/Notifications\
org.freedesktop.Notifications.SystemNoteInfoprint\
string:"Updating e-mail..."
#Make sure connection is open
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 10
#Sync
run-standalone.sh dbus-send --type=method_call\
--dest=com.nokia.asdbus /com/nokia/asdbus\
com.nokia.asdbus.syncEmail
date
date +%s > /tmp/prevmail.tmp
fi
fi
Ei kommentteja:
Lähetä kommentti