#!/bin/sh echo "$(date +%Y/%d/%y:%H.%M.%S) -- START" >> /var/log/checksim.log echo $$ > /var/run/sim.pid while true; do INTERVAL=`date +%S` IMSI=`dbus-send --system --type=method_call --print-reply --dest=com.nokia.phone.SIM /com/nokia/phone/SIM Phone.Sim.get_imsi 2>/dev/null | grep string | cut -f 5 -d " " | sed "s/\"//g"` TIMESTAMP=`date +%Y/%d/%y:%H.%M.%S` case $INTERVAL in 00|0000|1500|3000|4500) echo "$TIMESTAMP -- MARK" >> /var/log/checksim.log ;; esac if [ -z $IMSI ]; then sleep 5 echo "$TIMESTAMP -- moving to 2G" >> /var/log/checksim.log dbus-send --system --type=method_call --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.set_selected_radio_access_technology byte:1 dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteDialog string:"SWITCH TO 2G!" uint32:0 string:"OK" sleep 3600 TIMESTAMP=`date +%Y/%d/%y:%H.%M.%S` echo "$TIMESTAMP -- moving back to 3G/dual" >> /var/log/checksim.log dbus-send --system --type=method_call --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.set_selected_radio_access_technology byte:0 fi sleep 1 done