View Single Post
Saturn's Avatar
Posts: 1,648 | Thanked: 2,122 times | Joined on Mar 2007 @ UNKLE's Never Never Land
#789
Here is also some improvement to the code of BluesLee if someone wants to use it.

* Requirement is to have the "smssend" package installed (you can find it in extras).
* Will send an SMS with the cell info the phone is connected to the number you have defined in the SMSCON configuration.

Code:
#!/bin/sh
# smscon script (v0.8.1)
# (edit below)

if dpkg -l | grep smssend 1>/dev/null; 
then 
   ##Read SENDERNUMBER from config file
   SENDERNUMBER=`awk -F' ' '$1 == "SENDERNUMBER" { print $3;exit}' /opt/smscon/smscon_config|cut -d"'" -f2`
  
   ##Send SMS if smssend package is installed
   # get cellid codes via dbus command
   # MCC:        Mobile Country Code;        MNC:        Mobile Network Code;
   # LAC:        Local Area Code;         CELLID:        Cellid;
   EXPRESSION=`dbus-send --system --print-reply=literal --type=method_call --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.get_registration_status`
   MCC=`echo $EXPRESSION | cut -f 10 -d " "`
   MNC=`echo $EXPRESSION | cut -f 8 -d " "`
   LAC=`echo $EXPRESSION | cut -f 4 -d " "`
   CELLID=`echo $EXPRESSION | cut -f 6 -d " "`
   #echo $MCC $MNC $LAC $CELLID
   smssend -n $SENDERNUMBER -m "Cellid Info: MCC=$MCC; MNC=$MNC; LAC=$LAC; CELLID=$CELLID"
fi
 

The Following 2 Users Say Thank You to Saturn For This Useful Post: