//实现:在linux下通过短信猫发短信
//环境平台
CentOS5.4
intltool-0.41.1.tar.gz
gnokii-0.6.30.tar.gz
yum
//安装minicom及依赖包
yum -y install lockdev minicom perl-XML-Parser
//编译安装intltool
tar zxvf intltool-0.41.1.tar.gz
cd intltool-0.41.1
./configure
make
make install
//编译安装gnokii
tar zxvf gnokii-0.6.30.tar.gz
cd gnokii-0.6.30
./configure
make
make install
//配置minicom
/usr/bin/minicom -s
选择serial port setup
选择
A
( 按A键 ) 修改为
/dev/ttySO
//ttyS0 为com口
选择E( 按E键 ) 修改为
同样选择E,9600
回车
//保存配置,Save setup as dfl
//退出配置界面,Exit from Minicom
//测试minicom
/usr/bin/minicom
输入
AT 后回车,返回
ok 则成功
//退出minicom
按,[
Ctrl+A ] --> [
z ] --> [
x ]
//配置gnokii
mkdir -p /root/.config/gnokii
cp /usr/local/share/doc/gnokii/sample/gnokiirc /root/.config/gnokii/config
vi /root/.config/gnokii/config
[global]
port = /dev/ttyS0
model = AT
initlength = default
connection = serial
use_locking = no
serial_baudrate = 9600
smsc_timeout = 10
[xgnokii]
allow_breakage = 0
[gnokiid]
bindir = /usr/local/bin/
[connect_script]
TELEPHONE = 12345678
[disconnect_script]
[logging]
debug = off
rlpdebug = off
xdebug = off
[phone_fake]
port = foobar
model = AT
connection = serial
[fake_driver]
sms_inbox = /tmp/sms
//测试gnokii
/usr/local/bin/gnokii --identify
[root@Nagios ~]# gnokii --identify
GNOKII Version 0.6.30
Cannot open logfile /root/.cache/gnokii/gnokii-errors
WARNING: cannot open logfile, logs will be directed to stderr
Lockfile /var/lock/LCK..ttyS0 is stale. Overriding it...
IMEI : 351047888189814
Manufacturer : WAVECOM MODEM
No flags section in the config file.
Model : MULTIBAND 900E 1800
Product name : MULTIBAND 900E 1800
Revision : 641b09gg.Q2403A 132
//测试短信
echo -e "Give me a surprise" |/usr/local/bin/gnokii --sendsms 1581111****(号码)
//赋予权限
chown -R nagios.nagios /usr/local/bin/gnokii
chown -R nagios.nagios /dev/ttyS0