gpt4 book ai didi

systemd - 启动请求重复太快

转载 作者:行者123 更新时间:2023-12-04 22:58:10 24 4
gpt4 key购买 nike

我正在写bash脚本,但是我经常遇到这个问题。
当我尝试对服务进行startstop时,我经常得到:

start request repeated too quickly 

我怎么解决这个问题?
例如,当我尝试重新启动docker或openshift-origin master时。
sudo service origin-master restart

● origin-master.service - Origin Master Service
Loaded: loaded (/usr/lib/systemd/system/origin-master.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Wed 2016-02-17 08:22:11 UTC; 44s ago
Docs: https://github.com/openshift/origin
Process: 2296 ExecStart=/usr/bin/openshift start master --config=${CONFIG_FILE} $OPTIONS (code=exited, status=255)
Main PID: 2296 (code=exited, status=255)

Feb 17 08:22:10 ip-172-xx-xx-xx.eu-central-1.compute.internal systemd[1]: origin-master.service: main process exited, code=exited, status=255/n/a
Feb 17 08:22:10 ip-172-xx-xx-xx.eu-central-1.compute.internal systemd[1]: Failed to start Origin Master Service.
Feb 17 08:22:10 ip-172-xx-xx-xx.eu-central-1.compute.internal systemd[1]: Unit origin-master.service entered failed state.
Feb 17 08:22:10 ip-172-xx-xx-xx.eu-central-1.compute.internal systemd[1]: origin-master.service failed.
Feb 17 08:22:11 ip-172-xx-xx-xx.eu-central-1.compute.internal systemd[1]: origin-master.service holdoff time over, scheduling restart.
Feb 17 08:22:11 ip-172-xx-xx-xx.eu-central-1.compute.internal systemd[1]: start request repeated too quickly for origin-master.service
Feb 17 08:22:11 ip-172-xx-xx-xx.eu-central-1.compute.internal systemd[1]: Failed to start Origin Master Service.
Feb 17 08:22:11 ip-172-xx-xx-xx.eu-central-1.compute.internal systemd[1]: Unit origin-master.service entered failed state.
Feb 17 08:22:11 ip-172-xx-xx-xx.eu-central-1.compute.internal systemd[1]: origin-master.service failed.

我的脚本只是在做:
if [ $1 = "-u" ]
then
sudo service origin-master restart
fi

在执行脚本之前,可以手动重启。但是之后它仍然给出错误

最佳答案

这是systemctl的“功能”。文件中有一个参数,以秒为单位限制重新启动频率。在测试时降低此值。

编辑文件/etc/systemd/system/multi-user.target.wants/<your service here>
我的例子:

Restart=on-failure
StartLimitBurst=2
# Restart, but not more than once every 10 minutes
#StartLimitInterval=600
# Restart, but not more than once every 30s (for testing purposes)
StartLimitInterval=30

关于systemd - 启动请求重复太快,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35452591/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com