Mat*_*hew 21 sudo services nodejs systemd
我正在尝试将 Node.js API 作为服务运行,但遇到了问题。
运行时systemctl status servicename.service
出现以下错误:
servicename.service - [Service description]
Loaded: leaded (/etc/systemd/system/servicename.service; enabled; vendor preset: enabled)
Active: failed (Result: start-limit-hit) since [timestamp] ago
Process: 1142 ExecStart=/usr/bin/node /home/pi/Documents/server.js (code=exited, status=0/SUCCESS)
Main PID: 1142 (code=exited, status=0/SUCCESS)
[timestamp] hostname systemd[1]: servicename.service: Service hold-off time over, scheduling restart.
[timestamp] hostname systemd[1]: Stopped [Service description]
[timestamp] hostname systemd[1]: servicename.service: Start request repeated too quickly.
[timestamp] hostname systemd[1]: Failed to start [Service description]
[timestamp] hostname systemd[1]: servicename.service: Unit entered failed state.
[timestamp] hostname systemd[1]: servicename.service: Failed with result 'start-limit-hit'.
Run Code Online (Sandbox Code Playgroud)
这是什么错误,我该如何解决这个问题?
我想运行脚本,sudo
因为脚本的一部分需要管理员权限。
小智 18
可能是更正确的答案:
systemctl reset-failed servicename.service
取自https://serverfault.com/questions/930047/how-to-bypass-systemd-start-request-repeated-too-quickly
ago*_*dev 14
当您有start-limit-hit
或Start request repeated too quickly
可能是由于Restart=on-failure
服务定义中的指令所致。错误的最初原因很可能是有的,但它隐藏在您看到的原因背后。
要找出答案:(显然,用您的服务替换carbon-relay-ng)
systemctl status carbon-relay-ng
nano /lib/systemd/system/carbon-relay-ng.service
Restart=on-failure
并保存文件(第二张图片)systemctl restart carbon-relay-ng
systemctl status carbon-relay-ng
检查实际错误对我来说,它显示了以下错误,我必须通过设置文件权限来纠正该错误:
小智 10
跑
mkdir /var/run/sshd
然后
systemctl restart ssh
:竖起大拇指:
完毕!
小智 1
我也在为同样的错误而苦苦挣扎。这是由于应用程序一次又一次重新启动而发生的。在我的场景中,我的应用程序没有作为 systemd 服务运行,而是像恶魔模式一样运行。demon
检查您的应用程序是否以或运行systemd
。
归档时间: |
|
查看次数: |
100527 次 |
最近记录: |