mirror of
https://github.com/troglobit/finit.git
synced 2026-10-04 23:04:12 +07:00
Merge pull request #153 from troglobit/logit-post-signal
Logit post SIGTERM, SIGINT etc.
This commit is contained in:
+6
-6
@@ -191,9 +191,6 @@ static int lredirect(svc_t *svc)
|
||||
return -1;
|
||||
}
|
||||
|
||||
dup2(fd, STDOUT_FILENO);
|
||||
dup2(fd, STDERR_FILENO);
|
||||
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
int fds;
|
||||
@@ -240,6 +237,9 @@ static int lredirect(svc_t *svc)
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
dup2(fd, STDOUT_FILENO);
|
||||
dup2(fd, STDERR_FILENO);
|
||||
|
||||
return close(fd);
|
||||
}
|
||||
|
||||
@@ -371,6 +371,9 @@ static int service_start(svc_t *svc)
|
||||
}
|
||||
args[i] = NULL;
|
||||
|
||||
redirect(svc);
|
||||
sig_unblock();
|
||||
|
||||
/*
|
||||
* The setsid() call is the most humble of all in this
|
||||
* function. It takes care to detach the process from
|
||||
@@ -385,9 +388,6 @@ static int service_start(svc_t *svc)
|
||||
*/
|
||||
setsid();
|
||||
|
||||
redirect(svc);
|
||||
sig_unblock();
|
||||
|
||||
if (svc_is_runtask(svc))
|
||||
status = exec_runtask(svc->cmd, args);
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user