Debian

服務啟動請求重複太快,拒絕啟動

  • September 24, 2020

我在 Debian 8.6 上創建了一個服務,當我嘗試使用 service 命令啟動它時,我收到一個錯誤。

我試過systemctl daemon-reload了,但仍然得到相同的結果。

$ sudo service cloud9 start
$ sudo service cloud9 status
● cloud9.service - cloud9
  Loaded: loaded (/etc/systemd/system/cloud9.service; enabled)
  Active: failed (Result: start-limit) since Thu 2016-10-13 07:21:02 UTC; 2s ago
 Process: 2610 ExecStart=/opt/bitnami/nodejs/bin/node /home/user/c9sdk/server.js -w /home/user -l 0.0.0.0 -a admin:admin (code=exited, status=216/GROUP)
Main PID: 2610 (code=exited, status=216/GROUP)

Oct 13 07:21:02 test-vm systemd[1]: cloud9.service: main process exited, code=exited, status=216/GROUP
Oct 13 07:21:02 test-vm systemd[1]: Unit cloud9.service entered failed state.
Oct 13 07:21:02 test-vm systemd[1]: cloud9.service holdoff time over, scheduling restart.
Oct 13 07:21:02 test-vm systemd[1]: Stopping cloud9...
Oct 13 07:21:02 test-vm systemd[1]: Starting cloud9...
Oct 13 07:21:02 test-vm systemd[1]: cloud9.service start request repeated too quickly, refusing to start.
Oct 13 07:21:02 test-vm systemd[1]: Failed to start cloud9.
Oct 13 07:21:02 test-vm systemd[1]: Unit cloud9.service entered failed state.

配置在/etc/systemd/system/cloud9.service

[Unit]
Description=cloud9

[Service]
ExecStart=/opt/bitnami/nodejs/bin/node /home/user/c9sdk/server.js -w /home/user -l 0.0.0.0 -a admin:admin
Restart=always
User=nobody
Group=nobody
Environment=PATH=/bin:/usr/bin:/usr/local/bin
Environment=NODE_ENV=production
WorkingDirectory=/home/user/c9sdk

[Install]
WantedBy=multi-user.target
2610 ExecStart=/opt/bitnami/nodejs/bin/node /home/user/c9sdk/server.js -w /home/user -l 0.0.0.0 -a admin:admin (code=exited, status=216/GROUP)
…
10 月 13 日 07:21:02 test-vm systemd[1]: cloud9.service: 主程序退出,code=exited,status=216/GROUP

…描述了問題。您的組nobody不是系統上的有效組。指定一個有效的組。

環境=PATH=/bin:/usr/bin:/usr/local/bin

這可能是不必要的。

-w /home/user -l 0.0.0.0

在一個更好的世界中,這裡的 cloud9 服務程序將接收其偵聽套接字作為打開的文件描述符,並繼承其工作目錄(具有諷刺意味的是,您在單元的其他地方明確設置)。

進一步閱讀

引用自:https://unix.stackexchange.com/questions/316114