mirror of
https://github.com/troglobit/finit.git
synced 2026-10-22 11:36:07 +00:00
Add total restart counter for service & sysv daemons
This patch adds a recent feature request to keep track of the total number of restarts (including crashes and initctl restart) of both service and sysv daemons. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
823bb82b8c
commit
95995a45cf
3 files changed
+8
-1
No files matched your search
@@ -496,6 +496,12 @@ static int service_start(svc_t *svc)
|
||||
/* Declare we're waiting for svc to create its pidfile */
|
||||
svc_starting(svc);
|
||||
|
||||
/* Increment total restarts, unless first time or non-service */
|
||||
if (svc_is_daemon(svc) || svc_is_sysv(svc)) {
|
||||
if (svc->restart_cnt || svc->restart_tot)
|
||||
svc->restart_tot++;
|
||||
}
|
||||
|
||||
/* Block SIGCHLD while forking. */
|
||||
sigemptyset(&nmask);
|
||||
sigaddset(&nmask, SIGCHLD);
|
||||
|
||||
Reference in new issue
Block a user