From 3626273478af291634898dd9abb8d52e26aa1169 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 12 Jul 2024 14:18:26 +0200 Subject: [PATCH] s3:printing: Allow to run samba-bgqd as a standalone systemd service BUG: https://bugzilla.samba.org/show_bug.cgi?id=15683 Signed-off-by: Andreas Schneider Reviewed-by: Alexander Bokovoy (cherry picked from commit 0a532378322661b23b3393eb2ebde29402a16e62) --- source3/printing/samba-bgqd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source3/printing/samba-bgqd.c b/source3/printing/samba-bgqd.c index 59ed0cc40db..9560fcf9e35 100644 --- a/source3/printing/samba-bgqd.c +++ b/source3/printing/samba-bgqd.c @@ -253,7 +253,9 @@ int main(int argc, const char *argv[]) log_stdout = (debug_get_log_type() == DEBUG_STDOUT); /* main process will notify systemd */ - daemon_sd_notifications(false); + if (ready_signal_fd != -1 || watch_fd != -1) { + daemon_sd_notifications(false); + } if (!cmdline_daemon_cfg->fork) { daemon_status(progname, "Starting process ... "); @@ -325,6 +327,10 @@ int main(int argc, const char *argv[]) goto done; } + if (!cmdline_daemon_cfg->fork) { + daemon_ready(progname); + } + if (ready_signal_fd != -1) { pid_t pid = getpid(); ssize_t written; -- 2.45.2