Ubuntu – “respawning too fast, stopped”. How to make UPSTART disable for 5 mins

job-controlupstart

In the old days, the init daemon used to disable tasks that were respawning too fast.

I discovered to my peril that UPSTART just stops them. forever.

I have found the COUNT and INTERVAL controls for when to stop a job that is respawning fast, but I cannot find how to restart that job after a specified waiting time.

  • This is for a remote server that must connect via ssh in order for me to tunnel back into it. But it regularly has connection problems and the job that runs the ssh connection is dying! I foolishly expected upstart to keep the job running.

Is there a way, or do I need to do something like run a cron job to check if it is running and if not restart it?

Best Answer

Upstart allows a post-stop sleep in order to delay the restarting of a job. From http://upstart.ubuntu.com/cookbook/#delay-respawn-of-a-job

post-stop exec sleep 5

Now when the job fails, it will wait 5 seconds before attempting to connect again. Combine that with setting the respawn to something like 10 times in 30 seconds and it should try to respawn forever (it would only try 7 times in 30 seconds, so it shouldn't get kicked out of respawn)

Related Question