如何使用 mysql 配置 gammu-smsd
How to configure gammu-smsd with mysql
我正在尝试启动 gammu 短信服务,当我 运行 使用简单的存档时,它 运行 没问题,但是当我尝试 运行 使用mysql 数据库,它显示此错误:
错误代码:2002,错误:无法通过套接字 '/var/run/mysqld/mysqld.sock' (2)
连接到本地 MySQL 服务器
重启gammu-sms,显示如下信息:
user2@Lubuntu18:~$ service gammu-smsd restart
user2@Lubuntu18:~$ service gammu-smsd status
● gammu-smsd.service - SMS daemon for Gammu
Loaded: loaded (/lib/systemd/system/gammu-smsd.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2018-08-18 20:55:21 -04; 2min 52s ago
Docs: man:gammu-smsd(1)
Process: 19001 ExecStopPost=/bin/rm -f /var/run/gammu-smsd.pid (code=exited, status=0/SUCCESS)
Process: 18999 ExecStart=/usr/bin/gammu-smsd --pid=/var/run/gammu-smsd.pid --daemon (code=exited, status=0/SUCCESS)
Main PID: 19000 (code=exited, status=2)
ago 18 20:55:21 Lubuntu18 systemd[1]: Starting SMS daemon for Gammu...
ago 18 20:55:21 Lubuntu18 systemd[1]: gammu-smsd.service: Can't open PID file /var/run/gammu-smsd.pid (yet?) after start: No s
ago 18 20:55:21 Lubuntu18 systemd[1]: Started SMS daemon for Gammu.
ago 18 20:55:21 Lubuntu18 systemd[1]: gammu-smsd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
ago 18 20:55:21 Lubuntu18 systemd[1]: gammu-smsd.service: Failed with result 'exit-code'.
日志文件 gammu smsd 显示:
Sat 2018/08/18 20:55:21 gammu-smsd[19000]: Error connecting to database!
Sat 2018/08/18 20:55:21 gammu-smsd[19000]: Error code: 2002, Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Sat 2018/08/18 20:55:21 gammu-smsd[19000]: Initialisation failed, stopping Gammu smsd: Database connection timeout. (DB_TIMEOUT[78])
Sat 2018/08/18 20:55:21 gammu-smsd[19000]: Stopping Gammu smsd: Sin error. (NONE[1])
Docs: man:gammu-smsd(1)
Process: 19001 ExecStopPost=/bin/rm -f /var/run/gammu-smsd.pid (code=exited, status=0/SUCCESS)
Process: 18999 ExecStart=/usr/bin/gammu-smsd --pid=/var/run/gammu-smsd.pid --daemon (code=exited, status=0/SUCCESS)
Main PID: 19000 (code=exited, status=2)
ago 18 20:55:21 Lubuntu18 systemd[1]: Starting SMS daemon for Gammu...
ago 18 20:55:21 Lubuntu18 systemd[1]: gammu-smsd.service: Can't open PID file /var/run/gammu-smsd.pid (yet?) after start: No s
ago 18 20:55:21 Lubuntu18 systemd[1]: Started SMS daemon for Gammu.
ago 18 20:55:21 Lubuntu18 systemd[1]: gammu-smsd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
ago 18 20:55:21 Lubuntu18 systemd[1]: gammu-smsd.service: Failed with result 'exit-code'.
/etc/gammu-smsdrc是:
# Configuration file for Gammu SMS Daemon
# Gammu library configuration, see gammurc(5)
[gammu]
device = /dev/ttyUSB0
name = USB Qualcomm__Incorporated Qualcomm_CDMA_Technologies_MSM
connection = at
logfile = /home/ruser2/gammu.log
logformat = textall
# SMSD configuration, see gammu-smsdrc(5)
[smsd]
runonreceive = /opt/lampp/htdocs/kalkun/scripts/daemon.sh
service = sql
Driver = native_mysql
PIN= 1234
logfile = /home/user2/gammusmsd.log
# Increase for debugging information
debuglevel = 0
user = kalkun
password = kalkun
pc = localhost
database = kalkun
我使用 Lubuntu:
18.04
xampp 5.6.30
PHP 版本 5.6.23
有什么想法可以帮助我吗?非常感谢
您的用户没有权限,您以user2@Lubuntu18
开始。
尝试以 root 身份启动 gammu-smsd,或者给 user2 添加权限 dialout
。
sudo gammu-smsd -d --user gammu --group dialout
我正在尝试启动 gammu 短信服务,当我 运行 使用简单的存档时,它 运行 没问题,但是当我尝试 运行 使用mysql 数据库,它显示此错误:
错误代码:2002,错误:无法通过套接字 '/var/run/mysqld/mysqld.sock' (2)
连接到本地 MySQL 服务器重启gammu-sms,显示如下信息:
user2@Lubuntu18:~$ service gammu-smsd restart
user2@Lubuntu18:~$ service gammu-smsd status
● gammu-smsd.service - SMS daemon for Gammu
Loaded: loaded (/lib/systemd/system/gammu-smsd.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2018-08-18 20:55:21 -04; 2min 52s ago
Docs: man:gammu-smsd(1)
Process: 19001 ExecStopPost=/bin/rm -f /var/run/gammu-smsd.pid (code=exited, status=0/SUCCESS)
Process: 18999 ExecStart=/usr/bin/gammu-smsd --pid=/var/run/gammu-smsd.pid --daemon (code=exited, status=0/SUCCESS)
Main PID: 19000 (code=exited, status=2)
ago 18 20:55:21 Lubuntu18 systemd[1]: Starting SMS daemon for Gammu...
ago 18 20:55:21 Lubuntu18 systemd[1]: gammu-smsd.service: Can't open PID file /var/run/gammu-smsd.pid (yet?) after start: No s
ago 18 20:55:21 Lubuntu18 systemd[1]: Started SMS daemon for Gammu.
ago 18 20:55:21 Lubuntu18 systemd[1]: gammu-smsd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
ago 18 20:55:21 Lubuntu18 systemd[1]: gammu-smsd.service: Failed with result 'exit-code'.
日志文件 gammu smsd 显示:
Sat 2018/08/18 20:55:21 gammu-smsd[19000]: Error connecting to database!
Sat 2018/08/18 20:55:21 gammu-smsd[19000]: Error code: 2002, Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Sat 2018/08/18 20:55:21 gammu-smsd[19000]: Initialisation failed, stopping Gammu smsd: Database connection timeout. (DB_TIMEOUT[78])
Sat 2018/08/18 20:55:21 gammu-smsd[19000]: Stopping Gammu smsd: Sin error. (NONE[1])
Docs: man:gammu-smsd(1)
Process: 19001 ExecStopPost=/bin/rm -f /var/run/gammu-smsd.pid (code=exited, status=0/SUCCESS)
Process: 18999 ExecStart=/usr/bin/gammu-smsd --pid=/var/run/gammu-smsd.pid --daemon (code=exited, status=0/SUCCESS)
Main PID: 19000 (code=exited, status=2)
ago 18 20:55:21 Lubuntu18 systemd[1]: Starting SMS daemon for Gammu...
ago 18 20:55:21 Lubuntu18 systemd[1]: gammu-smsd.service: Can't open PID file /var/run/gammu-smsd.pid (yet?) after start: No s
ago 18 20:55:21 Lubuntu18 systemd[1]: Started SMS daemon for Gammu.
ago 18 20:55:21 Lubuntu18 systemd[1]: gammu-smsd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
ago 18 20:55:21 Lubuntu18 systemd[1]: gammu-smsd.service: Failed with result 'exit-code'.
/etc/gammu-smsdrc是:
# Configuration file for Gammu SMS Daemon
# Gammu library configuration, see gammurc(5)
[gammu]
device = /dev/ttyUSB0
name = USB Qualcomm__Incorporated Qualcomm_CDMA_Technologies_MSM
connection = at
logfile = /home/ruser2/gammu.log
logformat = textall
# SMSD configuration, see gammu-smsdrc(5)
[smsd]
runonreceive = /opt/lampp/htdocs/kalkun/scripts/daemon.sh
service = sql
Driver = native_mysql
PIN= 1234
logfile = /home/user2/gammusmsd.log
# Increase for debugging information
debuglevel = 0
user = kalkun
password = kalkun
pc = localhost
database = kalkun
我使用 Lubuntu:
18.04
xampp 5.6.30
PHP 版本 5.6.23
有什么想法可以帮助我吗?非常感谢
您的用户没有权限,您以user2@Lubuntu18
开始。
尝试以 root 身份启动 gammu-smsd,或者给 user2 添加权限 dialout
。
sudo gammu-smsd -d --user gammu --group dialout