Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

supervisord autorestart max tries?

Tags:

supervisord

http://supervisord.org/configuration.html#program-x-section-values says you can use autorestart=true to restart on exit, but doesn't say how to give a maximum amount of restarts (within startsecs) before giving up. Is there a way to do this? Note: I'm not talking about the first startup, but about the event that a program crashes after, say, running fine for 10 days.

According to the docs, autorestart doesn't care about startretries:

autorestart controls whether supervisord will autorestart a program if it exits after it has successfully started up (the process is in the RUNNING state).

supervisord has a different restart mechanism for when the process is starting up (the process is in the STARTING state). Retries during process startup are controlled by startsecs and startretries.

like image 737
unhammer Avatar asked Jan 29 '16 14:01

unhammer


People also ask

What is Autorestart supervisor?

autorestart controls whether supervisord will autorestart a program if it exits after it has successfully started up (the process is in the RUNNING state). supervisord has a different restart mechanism for when the process is starting up (the process is in the STARTING state).

How do I stop Supervisorctl?

Start / Stop a Service To start a non-running service or stop a running one, use supervisorctl start my-daemon and supervisorctl stop my-daemon . To restart a service, you can also use supervisorctl restart my-daemon .

How do I check my supervisor status?

The supervisor service runs automatically after installation. You can check its status: sudo systemctl status supervisor.

How does Supervisorctl work?

Supervisorctl allows a very limited form of access to the machine, essentially allowing users to see process status and control supervisord-controlled subprocesses by emitting “stop”, “start”, and “restart” commands from a simple shell or web UI.


2 Answers

You should use startretries as well, ex of program configuration:

[program:consumer_example]
command=command example
process_name=%(program_name)s_%(process_num)02d 
numprocs=1                                      
autostart=true
autorestart=true
startretries=10
user=USERNAME

As you can see I used startretries with 10, when you not inform into program it uses the default value (3).

like image 148
Paulo Victor Avatar answered Oct 29 '22 08:10

Paulo Victor


I think that you need is to use the startretries parameter..

http://supervisord.org/configuration.html?highlight=startretries#program-x-section-example

best regards

like image 40
Emmanuel Leveneur Avatar answered Oct 29 '22 08:10

Emmanuel Leveneur