start request repeated too quickly

2020-07-13 11:17发布

I'm writing a bash-script but I often face this issue. When I try to start or stop a service I often get:

start request repeated too quickly 

How can I solve this problem? It's for example when I try to restart docker or 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.

My script is just doing:

if [ $1 = "-u" ]
then
 sudo service origin-master restart
fi

A manual restart is possible before I've executed the script. But after it it remains giving the error

标签: systemd
2条回答
Lonely孤独者°
2楼-- · 2020-07-13 11:32

This is a "feature" of systemctl. There is a parameter in the file that limits the restart frequency in seconds. Lower this while testing.

Edit the file /etc/systemd/system/multi-user.target.wants/<your service here>

my example:

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
查看更多
干净又极端
3楼-- · 2020-07-13 11:32

I suggest you familiarize yourself with systemd. That's what you're using under the hood when you run service. As @chepner says, the service is failing (as you can see from the second line of the log), and it's being restarted too quickly, triggering the error.

Try running journalctl -u origin-master.service to figure out why the error is happening.

Also, systemd cat origin-master.service will show you the Service Unit file that describes your service - there might be errors.

查看更多
登录 后发表回答