Installation from rpm manager (yum)
Gnokii package is available via most of Linux distro repository, on Fedora 10 the below will install the gnokii package if not then do the installation from source.
yum install gnokii
Installing from Source:
1. Download the gnokii source download.
2. Untar the source and change (cd) to gnokii source directory
./configure (to configure)
make (to compile)
make install (to install the binaries)
Copy the example config file for gnokii from the Docs/sample/ directory to your home directory:
$ cp Docs/sample/gnokiirc ~/.gnokiirc
If you copied the .gnokiirc file to your home directory (not root) then do not forget to add your shell user account to uucp otherwise you wouldn't able to use gnokii due to permission problem on serial device you setup in .gnokiirc file.
askar wheel uucp
I have tested Gnokii with my Motorola L6/L7 cell phones check gnokii.org whether your phone is supported or not. (Tip.
Gnokii uses gnokiirc file for all this configuration, if gnokii has been installed via package manager then most probably it may have installed a /etc/gnokiirc file, the settings in this file will be used in the absence of a .gnokiirc file in your home directory.
Below is the minimum setting we need.
Note: usually you only need to edit the port and model part only
port = /dev/ttyACM0 # Set to port on which your phone is connect Tip: check /var/log/messages ]
model = AT
initlength = default
connection = serial
use_locking = no
serial_baudrate = 19200
smsc_timeout = 10
allow_breakage = 0
bindir = /usr/sbin/
#TELEPHONE = 12345678
debug = off # Turn it on for debugging
rlpdebug = off
xdebug = off
While phone is connected and /etc/gnokiirc or .gnokiirc has been setup properly.
2. Check if you phone has been recognize by gnokii.
GNOKII Version 0.6.27
IMEI : IMEI359411000810925
Manufacturer : Motorola CE, Copyright 2000
Model : GSM900","GSM1800","GSM1900","GS
Product name : GSM900","GSM1800","GSM1900","GS
Revision : R4513_G_08.B7.DCR_R
This is what I get for my Motorola L7 connected with via USB cable with my laptop running Fedora 10.
Note: you should see gnokii identified your cellphone/gsm modem, if you don't see it, update your ~/.gnokiirc or /etc/gnokiirc to suit your need
Note: During testing use 'root' account or you will need read/write permissions on whatever serial port you specify in /etc/gnokiirc or .gnokiirc file.
All the below information and more can be found here.
Backup & Restoration of phonebook on phone SM card using gnokii
gnokii --getphonebook SM 1 end --vcard > myphonebook.vcf
gnokii --writephonebook --vcard \< myphonebook.vcf
To dial a voice call:
gnokii --dialvoice 12345678
SMS Sending and Receiving
Use smsd if you need both to send and to receive SMS. You can use it with a file or a database backend.
If you only need to send, you can also use gnokii --sendsms, which reads message body from stdin.
echo "This is a test message" | gnokii --sendsms +12345678
gnokii --sendsms +12345678
type your text and press
Ctrl+d to exit.
You can also use the utils/sendsms bash script that uses a text based interface using dialog as a more friendly frontend to gnokii --sendsms, allowing you to pick recipient numbers from your phonebooks instead of typing them on the command line.
In my next article you can learn how to use Gnokii + Nagios for sending SMS Notifications from Nagios whenever there is problem with any of the monitored host/service