centos6.5 短信猫部署发短信
本文为在centos下部署短信猫发短信使用,以下为具体环境和步骤说明,欢迎留言!
一、环境说明
- 服务器:centos6.5 x64
- 依赖包:lockdev-1.0.1-18.el6.x86_64.rpm、lrzsz-0.12.20-27.1.el6.x86_64.rpm、minicom-2.3-8.el6.x86_64.rpm 、perl-XML-Parser-2.36-7.el6.x86_64.rpm及压缩包 gnokii-0.6.31.tar.gz和intltool-0.41.1.tar.gz。
二、步骤
1. 安装rpm包
rpm -ivh lockdev-1.0.1-18.el6.x86_64.rpm
rpm -ivh lrzsz-0.12.20-27.1.el6.x86_64.rpm
rpm -ivh minicom-2.3-8.el6.x86_64.rpm
rpm -ivh perl-XML-Parser-2.36-7.el6.x86_64.rpm
- 安装示意图如下:
2. 编译安装intltool,依次执行下面的命令
# tar zxvf intltool-0.41.1.tar.gz
# cd intltool-0.41.1
# ./configure
# make && make install
3. 编译安装minicom,依次执行下面的命令
# tar zxvf gnokii-0.6.31.tar.gz
# cd gnokii-0.6.30
#./configure
# make && make install
4. 配置minicom
# minicom -s
- 选择 serial port setup
- 进入后输入A,并编辑当前接入服务器的短信猫所处的com口,可以在任一目录下执行ll /deb/tty*,看到ttyUSB0或ttyUSB1时即可确定com口,波特率一般为115200;
- 按下回车,选中Save setup as dfl并 选中Exit from Minicom即可退出minicom。
5. 配置gnokii
- 创建目录并复制样例
# mkdir -p /root/.config/gnokii
# cp /usr/local/share/doc/gnokii/sample/gnokiirc /root/.config/gnokii/config
- 编辑并修改配置文件config
# vi /root/.config/gnokii/config
[global]
port = /dev/ttyUSB1
model = AT
initlength = default
connection = serial
use_locking = no
serial_baudrate = 115200
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 #上述三个开关为debug日志,打开后可以发送短信短信的过程
[phone_fake]
port = foobar
model = AT
connection = serial
[fake_driver]
sms_inbox = /tmp/sms
6. 测试发短信
echo -e "发送内容" |/usr/local/bin/gnokii --sendsms 1731773****(号码)
其中“”中的内容为发的内容,后面的号码为接收短信的手机号码。
7.附录
Lockdev下载路径:
https://centos.pkgs.org/6/centos-x86_64/lockdev-1.0.1-18.el6.x86_64.rpm.html
lrzsz下载路径:
https://pkgs.org/download/lrzsz
minicom下载路径:
https://centos.pkgs.org/6/centos-x86_64/minicom-2.3-8.el6.x86_64.rpm.html
perl-XML-Parser下载路径:
https://centos.pkgs.org/6/centos-x86_64/perl-XML-Parser-2.36-7.el6.x86_64.rpm.html
intltool下载路径:
http://download.chinaunix.net/download.php?id=38033&ResourceID=12284
gnokii下载路径:
http://www.gnokii.org/download/gnokii/