From: Jacek Konieczny <jajcus@jajcus.net>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 1/2] --foreground option added to dlm_controld
Date: Sat, 3 Nov 2012 16:27:55 +0100 [thread overview]
Message-ID: <1351956476-4261-2-git-send-email-jajcus@jajcus.net> (raw)
In-Reply-To: <1351956476-4261-1-git-send-email-jajcus@jajcus.net>
Foreground is the preferred way to run services from systemd
and it is easier to provide startup notification this way.
Signed-off-by: Jacek Konieczny <jajcus@jajcus.net>
---
dlm_controld/dlm_controld.8 | 3 +++
dlm_controld/dlm_daemon.h | 1 +
dlm_controld/main.c | 7 ++++++-
3 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/dlm_controld/dlm_controld.8 b/dlm_controld/dlm_controld.8
index 262ef8a..c9011fd 100644
--- a/dlm_controld/dlm_controld.8
+++ b/dlm_controld/dlm_controld.8
@@ -23,6 +23,9 @@ For default settings, see dlm_controld -h.
.B --daemon_debug | -D
enable debugging to stderr and don't fork
+.B --foreground
+ don't fork
+
.B --log_debug | -K
enable kernel dlm debugging messages
diff --git a/dlm_controld/dlm_daemon.h b/dlm_controld/dlm_daemon.h
index 916ee58..377f28d 100644
--- a/dlm_controld/dlm_daemon.h
+++ b/dlm_controld/dlm_daemon.h
@@ -109,6 +109,7 @@ enum {
enable_quorum_lockspace_ind,
help_ind,
version_ind,
+ foreground_ind,
dlm_options_max,
};
diff --git a/dlm_controld/main.c b/dlm_controld/main.c
index fd469f9..deda60c 100644
--- a/dlm_controld/main.c
+++ b/dlm_controld/main.c
@@ -1245,6 +1245,11 @@ static void set_opt_defaults(void)
0, NULL,
"enable debugging to stderr and don't fork");
+ set_opt_default(foreground_ind,
+ "foreground", '\0', no_arg,
+ 0, NULL,
+ "don't fork");
+
set_opt_default(log_debug_ind,
"log_debug", 'K', no_arg,
0, NULL,
@@ -1562,7 +1567,7 @@ int main(int argc, char **argv)
INIT_LIST_HEAD(&fs_register_list);
init_daemon();
- if (!opt(daemon_debug_ind)) {
+ if (!opt(daemon_debug_ind) && !opt(foreground_ind)) {
if (daemon(0, 0) < 0) {
perror("daemon error");
exit(EXIT_FAILURE);
--
1.7.7.4
next prev parent reply other threads:[~2012-11-03 15:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-03 15:27 [Cluster-devel] cluster4 dlm: startup notification for systemd Jacek Konieczny
2012-11-03 15:27 ` Jacek Konieczny [this message]
2012-11-03 15:27 ` [Cluster-devel] [PATCH 2/2] Startup notification by sd_notify() Jacek Konieczny
2012-11-05 16:20 ` [Cluster-devel] cluster4 dlm: startup notification for systemd David Teigland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1351956476-4261-2-git-send-email-jajcus@jajcus.net \
--to=jajcus@jajcus.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).