我有 fluidd 的 systemd 配置文件
[Unit]
Description=Fluentd
Wants=network-online.target
After=network-online.target
[Service]
User=xxx
Group=users
Type=simple
Restart=on-failure
RestartSec=5s
ExecStart=/usr/local/rvm/gems/ruby-2.7.2/bin/fluentd --config /etc/fluent/fluent.conf
[Install]
WantedBy=multi-user.target
systemctl status 输出如下:
xxx@test:/home/xxx # sudo systemctl status fluentd.service
● fluentd.service - Fluentd
Loaded: loaded (/etc/systemd/system/fluentd.service; enabled; vendor preset: disabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2023-02-08 20:51:05 UTC; 141ms ago
Process: 5286 ExecStart=/usr/local/rvm/gems/ruby-2.7.2/bin/fluentd --config /etc/fluent/fluent.conf (code=exited, status=127)
Main PID: 5286 (code=exited, status=127)
Feb 08 20:51:05 xenoss.io systemd[1]: Unit fluentd.service entered failed state.
Feb 08 20:51:05 xenoss.io systemd[1]: fluentd.service failed.
Warning: fluentd.service changed on disk. Run 'systemctl daemon-reload' to reload units.
但是当我使用这个运行时:
fluentd --config /etc/fluent/fluent.conf
我可以成功启动它,但是使用 systemd 却失败了
另外 fluid 输出:
/usr/local/rvm/gems/ruby-2.7.2/bin/fluentd
输出须藤journalctl -xeu Fluentd.service:
-- The start-up result is done.
Feb 09 23:10:45 xxx systemd[1]: Starting Fluentd...
-- Subject: Unit fluentd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit fluentd.service has begun starting up.
Feb 09 23:10:45 xxx systemd[1]: fluentd.service: main process exited, code=exited, status=127/n/a
Feb 09 23:10:45 xxx systemd[1]: Unit fluentd.service entered failed state.
Feb 09 23:10:45 xxx systemd[1]: fluentd.service failed.