procd: fire events at instance respawn and failure
authorZefir Kurtisi <zefir.kurtisi@neratec.com>
Thu, 13 Oct 2016 14:50:56 +0000 (16:50 +0200)
committerJohn Crispin <john@phrozen.org>
Fri, 14 Oct 2016 22:52:00 +0000 (00:52 +0200)
In addition to the existing 'start' and 'stop',
this commit adds 'respawn' and 'fail' events
to allow system monitors to detect and handle
unstable processes.

Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
service/instance.c

index 8f7835a79f34415dd07a13fa30e26adabac9e463..b7839660654a3548a6674a26b19a99f48c55edd9 100644 (file)
@@ -526,7 +526,9 @@ instance_exit(struct uloop_process *p, int ret)
                                                                in->srv->name, in->name, in->respawn_count, runtime);
                        in->restart = in->respawn = 0;
                        in->halt = 1;
+                       service_event("instance.fail", in->srv->name, in->name);
                } else {
+                       service_event("instance.respawn", in->srv->name, in->name);
                        uloop_timeout_set(&in->timeout, in->respawn_timeout * 1000);
                }
        }