Editing Fcron

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 236: Line 236:
<source lang="bash">
<source lang="bash">
#!/bin/sh
#!/bin/sh
-
#
+
if [ `route | awk '/au/ {print $1}'` = default ]; then
-
# n900 / maemo script to trigger an email fetch; connect to the internet if possible & necessary
+
exit
-
#
+
else
-
# Copyright: 2011 Martin Dengler <martin@martindengler.com>
+
-
# Dual License: MIT / GPL v3+
+
-
# Latest version: http://wiki.maemo.org/Fcron#Update_e-mail
+
-
 
+
-
retrys=5
+
-
 
+
-
while [ $retrys -gt 0 ] ; do
+
-
    if /sbin/route | grep -q "^default " ; then
+
-
        break  #...we are connected
+
-
    else
+
-
        run-standalone.sh dbus-send --system --type=method_call --dest=com.nokia.icd --print-reply /com/nokia/icd com.nokia.icd.connect string:"[ANY]" uint32:0
+
-
        retrys=`expr $retrys - 1`
+
-
        sleep 1
+
-
    fi
+
-
done
+
-
 
+
-
/sbin/route | grep -q "^default " || exit 1
+
-
 
+
run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"Updating e-mail..."
run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"Updating e-mail..."
 +
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
run-standalone.sh dbus-send --type=method_call --dest=com.nokia.modest /com/nokia/modest com.nokia.modest.SendReceive
run-standalone.sh dbus-send --type=method_call --dest=com.nokia.modest /com/nokia/modest com.nokia.modest.SendReceive
-
 
+
sleep 100
-
sleep 120
+
  if [ `ifconfig gprs0 | awk -F " " '/s0/ {print $2}'` = Link ]; then
-
 
+
-
# if we connected just for this, disconnect
+
-
if [ $retrys -lt 5 ]; then
+
   run-standalone.sh dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true
   run-standalone.sh dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true
 +
  fi
 +
run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"E-mail updated"
fi
fi
-
 
-
# no need to send another notification because we can't be sure the email updated anyway, and if you're still staring at the screen after two minutes waiting for a five-second notification to appear you need something better to do
 
</source>
</source>

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)
Retrieved from "http://wiki.maemo.org/Fcron"