我已经在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
1
如果systemctl打印的错误不是很清楚,则可能是由于根本原因被吞没并掩盖为启动失败。找出失败原因的一种可能有用的方法是,仅手动运行ExecStart指令中指定的命令。就我而言,根本原因突然出现在我身上。
—
Ubunfu