我正在尝试安装Gammu 1.42在Centos 8上为我的SMS网关服务。
使,使测试,使安装工作良好。
在/etc/profile中配置为: LD_LIBRARY_PATH:
......
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:.:/usr/local/lib64
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL LD_LIBRARY_PATH
......我用printenv打印env,LD_LIBRARY_PATH发现。/etc/gammu-smsdrc配置为:
......
[gammu]
device = /dev/ttyUSB0
model = E3131
connection = at115200
[smsd]
service = sql
driver = native_pgsql
logFIle = /var/log/gammu/smsd.log
logFormat = errorsdate
Host = xx.0.1.xx:xxxx
user = xxxx
password = xxxxx
database = xxxxx
debuglevel = 2
StatusFrequency = 60
LoopSleep = 60
DeliveryReport = sms
PhoneID = ozssc-smsd
SMSC = +614xxxxxxxx
BackendRetries = 60我试过在终端上启动gammu命令行,它工作得很好。但是当我试图使用systemctl启动系统服务时,它失败了。
错误查询结果如下:
[root@Centos8Gateway etc]# systemctl status gammu-smsd.service
● gammu-smsd.service - SMS daemon for Gammu
Loaded: loaded (/usr/lib/systemd/system/gammu-smsd.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2020-10-25 12:13:42 AEDT; 19s ago
Docs: man:gammu-smsd(1)
Process: 23247 ExecStopPost=/bin/rm -f /var/run/gammu-smsd.pid (code=exited, status=0/SUCCESS)
Process: 23245 ExecStart=/usr/local/bin/gammu-smsd --pid=/var/run/gammu-smsd.pid --daemon (code=exited, status=127)
Oct 25 12:13:42 Centos8Gateway systemd[1]: Starting SMS daemon for Gammu...
Oct 25 12:13:42 Centos8Gateway gammu-smsd[23245]: /usr/local/bin/gammu-smsd: error while loading shared libraries: libgsmsd.so.8: cannot open shared object file: No such file or directory
Oct 25 12:13:42 Centos8Gateway systemd[1]: gammu-smsd.service: Control process exited, code=exited status=127
Oct 25 12:13:42 Centos8Gateway systemd[1]: gammu-smsd.service: Failed with result 'exit-code'.
Oct 25 12:13:42 Centos8Gateway systemd[1]: Failed to start SMS daemon for Gammu.
[root@Centos8Gateway etc]# 我试图找出为什么Centos 8系统服务加载器不使用配置的系统环境变量?也不提供命令行lib路径参数。
我错过了什么?请指点!
发布于 2020-10-25 06:38:53
解决这一问题的另一种方法是:
重试从系统done完成启动gammu-smsd。
发布于 2020-10-25 06:26:55
/etc/profile由bash之类的shell使用;它不用于为systemd服务设置环境。
若要向systemd服务提供环境变量,请在systemd单元文件中使用Environment=`,例如:
Environment="LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64"请注意,与您在$LD_LIBRARY_PATH中的内容相比,我省略了.和/etc/profile:
.有点不寻常;在系统单元的上下文中,它将是您已经知道/应该知道的WorkingDirectory的值,在这种情况下,您也可以显式地扩展它,以获得清晰和明确的期望。https://serverfault.com/questions/1039983
复制相似问题