[PATCH 13/15] statd: allow --no-notify to be passed via environment variable.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The significant value of allowing this is that it means that
for default operation, systemd unit files do not need to pass any
options to any programs.  The purpose of this will become apparent in
the next patch.

Signed-off-by: NeilBrown <neilb@xxxxxxxx>
---
 systemd/rpc-statd.service |    3 ++-
 utils/statd/statd.c       |    5 +++++
 utils/statd/statd.man     |    5 +++++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/systemd/rpc-statd.service b/systemd/rpc-statd.service
index a02f5c41a424..d5392b7cff4d 100644
--- a/systemd/rpc-statd.service
+++ b/systemd/rpc-statd.service
@@ -11,7 +11,8 @@ Wants=nfs-config.service
 After=nfs-config.service
 
 [Service]
+Environment=RPC_STATD_NO_NOTIFY=1
 EnvironmentFile=-/run/sysconfig/nfs-utils
 Type=forking
 PIDFile=/var/run/rpc.statd.pid
-ExecStart=/usr/sbin/rpc.statd --no-notify $STATDARGS
+ExecStart=/usr/sbin/rpc.statd $STATDARGS
diff --git a/utils/statd/statd.c b/utils/statd/statd.c
index 5f4ad79e6bf3..1c34c9ef02cb 100644
--- a/utils/statd/statd.c
+++ b/utils/statd/statd.c
@@ -251,10 +251,15 @@ int main (int argc, char **argv)
 	int nlm_udp = 0, nlm_tcp = 0;
 	struct rlimit rlim;
 	int notify_sockfd;
+	char *env;
 
 	/* Default: daemon mode, no other options */
 	run_mode = 0;
 
+	env = getenv("RPC_STATD_NO_NOTIFY");
+	if (env && atoi(env) > 0)
+		run_mode |= MODE_NO_NOTIFY;
+
 	/* Log to stderr if there's an error during startup */
 	xlog_stderr(1);
 	xlog_syslog(0);
diff --git a/utils/statd/statd.man b/utils/statd/statd.man
index 91c260f1bf5e..71d58461b5ea 100644
--- a/utils/statd/statd.man
+++ b/utils/statd/statd.man
@@ -418,6 +418,11 @@ it attempts to start listeners on network transports marked 'visible' in
 As long as at least one network transport listener starts successfully,
 .B rpc.statd
 will operate.
+.SH ENVIRONMENT
+.TP
+.B RPC_STATD_NO_NOTIFY=
+If set to a positive integer, has the same effect as
+.IR \-\-no\-notify .
 .SH FILES
 .TP 2.5i
 .I /var/lib/nfs/sm


--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux