forked from pool/slurm
Egbert Eich
8d80dfc527
daemonizing process doesn't go away until the PID file with it PID of the daemon has bee written (bsc#1084125). OBS-URL: https://build.opensuse.org/package/show/network:cluster/slurm?expand=0&rev=52
48 lines
1.3 KiB
Diff
48 lines
1.3 KiB
Diff
From: Christian Goll <cgoll@suse.de>
|
|
Date: Mon Apr 9 10:59:57 2018 +0200
|
|
Subject: slurmd uses xdaemon_* for systemd
|
|
Patch-mainline: Not yet
|
|
Git-repo: https://github.com/SchedMD/slurm
|
|
Git-commit: a048f30f7e41089f9f2f014897ca2c02bc41abb5
|
|
References: bsc#1084125
|
|
|
|
|
|
Signed-off-by: Egbert Eich <eich@suse.de>
|
|
---
|
|
src/slurmd/slurmd/slurmd.c | 8 ++++++--
|
|
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/slurmd/slurmd/slurmd.c b/src/slurmd/slurmd/slurmd.c
|
|
index 09d3a7136b..299fe3a2a9 100644
|
|
--- a/src/slurmd/slurmd/slurmd.c
|
|
+++ b/src/slurmd/slurmd/slurmd.c
|
|
@@ -214,7 +214,7 @@ static void _wait_for_all_threads(int secs);
|
|
int
|
|
main (int argc, char **argv)
|
|
{
|
|
- int i, pidfd;
|
|
+ int i, pidfd, pipefd;
|
|
int blocked_signals[] = {SIGPIPE, 0};
|
|
int cc;
|
|
char *oom_value;
|
|
@@ -299,7 +299,8 @@ main (int argc, char **argv)
|
|
* Become a daemon if desired.
|
|
*/
|
|
if (conf->daemonize) {
|
|
- if (xdaemon())
|
|
+ pipefd = xdaemon_init();
|
|
+ if (pipefd == -1)
|
|
error("Couldn't daemonize slurmd: %m");
|
|
}
|
|
test_core_limit();
|
|
@@ -355,6 +356,9 @@ main (int argc, char **argv)
|
|
|
|
conf->pid = getpid();
|
|
pidfd = create_pidfile(conf->pidfile, 0);
|
|
+ if (conf->daemonize) {
|
|
+ xdaemon_finish(pipefd);
|
|
+ }
|
|
|
|
rfc2822_timestamp(time_stamp, sizeof(time_stamp));
|
|
info("%s started on %s", slurm_prog_name, time_stamp);
|