Add support for multiple instances of the same command

This patch adds support for starting and supervising multiple
services (run, task, or service) using an extra #ID number.

service #1 [2345] /sbin/httpd -f -h /http -p 80   -- Web server
service #2 [2345] /sbin/httpd -f -h /http -p 8080 -- Old web server

Also included in this patch is a fix for endless respawn of faulty
services.  For instance, a buggy daemon that crashes repeatedly will now
be stopped after 10 respawns.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2015-05-31 01:58:20 +02:00
1 parent 687f52b0b5
commit cb075560ed
8 files changed
+89 -109

No files matched your search

+6 -2
View File
@@ -87,9 +87,13 @@ int plugin_unregister(plugin_t *plugin)
TAILQ_REMOVE(&plugins, plugin, link);
if (plugin->svc.cb) {
svc_t *svc = svc_find(plugin->name);
svc_t *svc;
/* Unregister plugin callback for all matching services */
for (svc = svc_iterator(1); svc; svc = svc_iterator(0)) {
if (strcmp(svc->cmd, plugin->name))
continue;
if (svc) {
svc->cb = NULL;
svc->dynamic = 0;
svc->dynamic_stop = 0;