我在 centos 7 中有一个守护进程,我正尝试将其设置为通过 systemd 在启动时执行。该守护进程是一个二进制文件(c 源),它执行分叉并更改 id/group。
我遇到的问题是 systemd 似乎在超时后终止了守护进程。我不确定它是否认为进程没有正确启动,或者它是否试图查看它是否仍处于活动状态。无论如何,以下是状态信息:
[root@billing init.d]# systemctl status bx_edge.service
bx_edge.service - BillMax Customer Portal Daemon
Loaded: loaded (/etc/systemd/system/bx_edge.service; disabled; vendor preset: disabled)
Active: failed (Result: timeout) since Thu 2016-09-22 00:02:48 UTC; 48s ago
Process: 10611 ExecStop=/bin/pkill edge (code=exited, status=0/SUCCESS)
Process: 10606 ExecStart=/usr/local/billmax/bin/edge -i -o (code=exited, status=0/SUCCESS)
Main PID: 10609 (code=exited, status=0/SUCCESS)
Sep 22 00:01:18 billing.billmax.com systemd[1]: Starting BillMax Customer Portal Daemon...
Sep 22 00:01:18 billing.billmax.com systemd[1]: Started BillMax Customer Portal Daemon.
Sep 22 00:02:48 billing.billmax.com systemd[1]: bx_edge.service stop-sigterm timed out. Killing.
Sep 22 00:02:48 billing.billmax.com systemd[1]: Unit bx_edge.service entered failed state.
Sep 22 00:02:48 billing.billmax.com systemd[1]: bx_edge.service failed.
我的服务文件如下所示:
[Unit]
Description=BillMax Customer Portal Daemon
After=network.target
[Service]
ExecStart=/usr/local/billmax/bin/edge -i -o
ExecStop=/bin/pkill edge
Type=forking
[Install]
WantedBy=default.target
这是什么原因造成的?我尝试更改 Type 值,但结果还是一样。
账单