Langue: en

Autres versions - même langue

Version: 385387 (fedora - 01/12/10)

Section: 8 (Commandes administrateur)


gnokii-gnokii-smsd.- daemon for handling incoming and outgoing SMSes using libgnokii




The SMSD (SMS daemon) program is intended for receiving and sending SMSes.

The program is designed to use modules (plugins) to work with different backends. Currently are supported PostgreSQL, MySQL and a special module 'file' which is designed to work without an SQL database (see below for special instructions in the file module section). When SMSD uses an SQL server as a repository for SMSes you must create a database (default name is 'sms') with tables defined in sms.tables.{module}.sql files. Table 'inbox' is for received SMSes:

phone number from which is sms received
date set by SMS center
date SMS was inserted into table
SMS text
number of phone to use. If you use gnokii-gnokii-smsd.without -t option you can ignore this column. See -t option below.
gnokii-gnokii-smsd.sets this always to FALSE. You can use it for another program which will parse SMSes.

When the phone receives an SMS, SMSD moves it into 'inbox' table and removes the SMS from the phone.

Table 'outbox' is for outgoing SMSes. SMSD periodically looks into this table and searches for lines with attribute 'processed' set to FALSE. If it finds such SMS, it will send SMS to 'number':

recipient's phone number
date of processing SMS.
date of inserting SMS in table
SMS text
number of phone to use. If you use gnokii-gnokii-smsd.without -t option you must not fill this column. See -t option below.
new SMS must have this attribute set to FALSE. SMSD will send this SMS and will update 'processed' to TRUE.
This attribute contains return value of gn_sms_send() function. For explanation of numeric values see <gnokii/error.h> in gnokii source.
request for delivery report per message. Possible values are 0 for no delivery report, 1 for delivery report.
sms will not be sent before this time (default 00:00:00).
sms will not be sent after this time (default 23:59:59).

SMSD is multi threaded program. If you list processes you will see more than one instance of gnokii-smsd.


This module doesn't need an SQL server to work. For incoming messages it works in a way that it calls a program giving phone number, date as parameter and the message text on stdin. In the there is an example file action. It shows sms data to stdout. If you want something useful you must write your own action. Foroutgoingmessagesyoucansetspooldirectorywheregnokii-gnokii-smsd.looks regularly.

Incoming sms are passed in format

action number date < sms

Outgoing sms must be in format:


The name of file is unimportant but gnokii-gnokii-smsd.ignores all files with prefix "ERR.". If gnokii-gnokii-smsd.succesfully sends sms, it removes file from spool directory. If gnokii-gnokii-smsd.cannot send sms prepends file with "ERR." prefix and ignores it. If you use -m file, -u (--user) and -c (--host) will have other meaning. -u is for action (action must be executable) -c is for spool directory where gnokii-gnokii-smsd.looks for smses. Smsd must have read and write permissions to this directory.

-p, -d parameters have no meaning when -m file is used.

If you don't specify -u, default action is to print sms to stdout. If you don't specify -c, sms sending will be disabled.


Available options:

-u, --user db_username
Specify user name.
-p, --password db_password
Specify user password.
-d, --db db_name
Specify database name.
-c, --host db_hostname
Specify database server host name.
-s, --schema db_hostname
Specify database schema.
-m, --module db_module
Specify which module to use for connection to DB server. Currently supported values are 'pq' for PostgreSQL, 'mysql' for MySQL and 'file'.
-l, --libdir path_to_db_module
Specify path to DB modules. If you specify pq module, gnokii-gnokii-smsd.searches in libdir for file (for mysql - Do not interchange these plugins with default SQL libraries from database distribution!
-f, --logfile file
If used, gnokii-gnokii-smsd.will monitor sms traffic to file "file". File is reopened and closed for every message so you can simply rename or delete it if you want to rotate logs. If you use '-' as filename smsd will use standard output.
-t, --phone phone_number
You can run more instances of gnokii-smsd. One instance per phone. In this setup you must configure phone section in gnokiirc. For example:
[global] port = /dev/ttyS0 model = 6110 initlength = default connection = serial bindir = /usr/local/sbin/ use_locking = no serial_baudrate = 38400 smsc_timeout = 10
[phone_1] port = /dev/ttyS0 model = 6110 initlength = default connection = serial bindir = /usr/local/sbin/ use_locking = no serial_baudrate = 38400
[phone_2] port = /dev/ttyS1 model = AT initlength = default connection = serial bindir = /usr/local/sbin/ use_locking = no serial_baudrate = 38400 smsc_timeout = 10
In this setup if you run gnokii-gnokii-smsd.without -t option it will use config from global section. If you run gnokii-gnokii-smsd.with -t 1 it will use config from phone_1 and likewise with -t 2 uses phone_2. In case of use -t option gnokii-gnokii-smsd.fills phone number for incoming sms's and in outbox it looks only for sms's with the specified phone number in column 'phone'. This behaviour gives you possibility to run one instance of gnokii-gnokii-smsd.for every phone you have at the same time.
-i, --interval interval
Polling interval for incoming sms's in seconds. Default is 1 second.
-S, --maxsms number
When phone driver doesn't support sms status it is possible to specify number of sms's supported by phone. Default is 10. If driver support sms status this option is ignored.
-b, --inbox memory_type
Where to look for new messages. For the memory_type you usually use SM for the SIM card and ME for the phone memory. The exception are the phones supported by nk7110 (Nokia 7110/6210/6250) and nk6510 (Nokia 6310/6510/8310) drivers. For these you should use IN for the Inbox, OU for the Outbox, AR for the Archive, TE for the Templates and F1, F2, ... for your own folders.
-0, --firstpos0
SMSD starts messages reading from position 1. If your phone stores sms's from postion 0, use this option.
-v, --version
Shows gnokii-gnokii-smsd.version.
-h, --help
Shows short help.


Various error messages are printed to STDERR.


None reported.


SMSD was written by Jan Derfinak and contributed by other people. See also Docs/CREDITS from the Gnokii sources.


This program is distributed under the GNU Public License.