Nebojsa Milovanovic (mail: nesha on


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 - numbers in that array are hops when gsmqueue tries to send failed messages)

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



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

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/ > /dev/null 2>&1; /usr/local/bin/ > /dev/null 2>&1; /usr/local/bin/ > /dev/null 2>&1


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

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


Released under GPL