Skip to content

feature: add support for runningregex to set RUNNING state accordingly #1446

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Conversation

dat-h-ammann
Copy link

The runningregex option can be used to only set the RUNNING state of a process, if the child process is considered to be running. This is done by looking into the stdout and check whether an expected output has been recognized. If so, the process will set to running state. This requires the child process to create the corresponding output, otherwise the RUNNING state is never reached.

Closes #1445

This option can be used by adding runningregex to the config of a program.

In the following minimal example, the running state will be set when "Hello World!" is printed.
[program:hello_world]
command = /bin/sh -c "sleep 10 && echo Hello World! && sleep 10"
runningregex=Hello
stdout_logfile=./log/hello_world.log

@dat-h-ammann dat-h-ammann force-pushed the feature-add-runningregex-option branch from b5a95b9 to 9bdac9f Compare July 14, 2021 12:25
…s if no logfile is defined and handle the case when the logfile is deleted or moved while supervisor runs
@mnaberez
Copy link
Member

mnaberez commented Mar 23, 2022

A feature that continuously evaluates regular expressions against log files and if matches occur then actions are performed is not something that I want to support in the core of supervisord, sorry.

It's possible to write plug-ins for Supervisor in the form of eventlisteners and RPC extensions. It should be possible to implement this feature without adding new code to the core of Supervisor. An eventlistener can receive log data and an RPC interface can change process state.

In the past, when it's been possible to write a plugin for feature, we have put the feature into a plugin instead of into the core. For example, some users have wanted to restart a process when it uses "too much" memory or when it doesn't respond to HTTP requests. Those ended up being the memmon and httpok plugins. A few plugins are maintained by the Supervisor developers, but most are maintained by the community.

There's a list of plugins on the website and we'd be happy to add a link if it was implemented as a plugin.

@mnaberez mnaberez closed this Mar 23, 2022
@dat-h-ammann
Copy link
Author

dat-h-ammann commented Apr 13, 2022

Appreciate all the effort you put into supervisord and the clear answer.
I fully understand that you do not want to add this feature to the core. However I believe this is a very useful functionality. For our use cases we take advantage of this for almost all programs. Thanks for pointing out the approach using the RPC interface. I will have a look and try to implement this.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

how to start dependent processes only when another child process is ready?
2 participants