Nebojsa Milovanovic (mail: nesha on nesha.net)

GSMqueue


Send and receive SMS on linux via command line

I am not familiar with perl but I found a good perl scripts from Henry Palonen about some sort of queue for gnokii
I need to change them 'cause they don't work with new version of gnokii and I want to change the way of sending sms with multyply recipients (I think that it is better to threat that kind of messages like separate messages - in case of failed sending to some of recipients) and I want to auto retry sending of failed messages (you can change array variable "when_retry" in gsmqueue.pl - numbers in that array are hops when gsmqueue tries to send failed messages)

Prepare:
Install gnokii and put your gsm modem in port line under global in /etc/gnokiirc
(e.g. port = /dev/ttyUSB0)


Downloads:

gsmqueue.pl
sendsms.pl
gsmcontrol.pl
getsms.pl


Instalations:


Copy scripts to some directory. e.g. /usr/local/bin
Make sure scripts are executable:
chmod a+rx /usr/local/bin/sendsms.pl
chmod a+rx /usr/local/bin/gsmqueue.pl
chmod a+rx /usr/local/bin/gsmcontrol.pl
chmod a+rx /usr/local/bin/getsms.pl


Make world-writable directories under /var/gsm
mkdir /var/gsm
mkdir /var/gsm/fail
mkdir /var/gsm/in
mkdir /var/gsm/in.handled
mkdir /var/gsm/out
mkdir /var/gsm/sent
mkdir /var/gsm/tmp
chmod -R a+rwx /var/gsm


put this line in cron:
* * * * * /usr/local/bin/gsmqueue.pl > /dev/null 2>&1; /usr/local/bin/getsms.pl > /dev/null 2>&1; /usr/local/bin/gsmcontrol.pl > /dev/null 2>&1


Test


Send the same SMS to three different numbers:
echo "Test sms" | /usr/local/bin/sendsms.pl 381641234567,381641234568,3811234569

Receive SMS:
Send SMS to number on your GSM modem
You will receive email (your email adress is okemail varaible in getsms.pl) with SMS in body

Copyright

Released under GPL