Sending SMS using gnokii

From Alpine Linux
Jump to: navigation, search

In this tutorial we are using gnokii to send SMS


This doc is documented and tested based on Alpine Linux 2.7, but it might work for earlier versions too.
You will also need some sort of modem that can send SMS (e.g. a USB dongle with a SIM-card).


  • Install required package(s)

apk add gnokii

  • Create missing folders

mkdir -p /root/.cache/gnokii/

  • Physically attach a SMS capable modem to the host


  • Add the following content to '/etc/gnokiirc'
port = /dev/ttyUSB0
model = AT
connection = serial
use_locking = yes
serial_baudrate = 115200
smsc_timeout = 30

binddir = /usr/bin/

debug = off
rlpdebug = off
xdebug = off
Note: You will most likely need to change the above config so it to suit your equipment and setup.
  • Verify if the configuration works as expected

gnokii --identify

Note: You should receive a output that looks something like this:
GNOKII Version 0.6.31
Cannot open logfile /root/.cache/gnokii/gnokii-errors
WARNING: cannot open logfile, logs will be directed to stderr
IMEI         : 123456789012345
Manufacturer : Undefined
No flags section in the config file.
Model        : Teltonika TM1
Product name : Teltonika TM1
Revision     : VilniusSMD 05.94.01

Sending SMS

  • Now send a SMS

echo "Test sms" | gnokii --sendsms 123456

Note: You will need to replace 123456 with the phone number you want to send your test SMS