Using Sony Ericsson GM29 GPRS modem on Linux to send text messages.
I use this kind of code which I get from usenet but I have modified it for my own purpose:
<br /> #! /usr/bin/kermit +<br /> set port /dev/ttyS0<br /> set speed 9600<br /> if fail { # Check that port was obtained<br /> exit 1 \m(port): \v(setlinemsg)<br /> }</p> <p>set carrier-watch off<br /> set session-log text<br /> log session output<br /> output AT+CMGF=1\13<br /> input /nomatch 10<br /> output AT+CSDH=1\13<br /> input /nomatch 10<br /> output AT+CSMP=17,167,0,0\13<br /> input /nomatch 10<br /> output AT+CMGS="phone_number"\13<br /> input /nomatch 10<br /> output \&_[1]\26<br /> input /nomatch 10<br /> output +CMGS: 15\13</p> <p>close session<br /> exit<br />
You can write your message directly to this script if you want. You just have to change this line:
output \&_[1]\26
to look more like this:
output My Message\26
but I use \&_[1] because I want to give message as command line parameter.
Example if I want to send text message to my phone when my Linux server is offline I just have to write script which notice if my server is offline and then
run this script:
sms.sh Offline
and then it sends message “Offline” to my phone. Of course this was just a really basic example =)
Leave a Reply