linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Mike Frysinger <vapier@gentoo.org>
Cc: Steve Dickson <SteveD@redhat.com>, linux-nfs@vger.kernel.org
Subject: Re: [PATCH nfs-utils] start-statd: clean up output when systemd is not installed
Date: Tue, 19 Aug 2014 11:06:03 +1000	[thread overview]
Message-ID: <20140819110603.38b92ecb@notabene.brown> (raw)
In-Reply-To: <1649346.61nAovKFdn@vapier>

[-- Attachment #1: Type: text/plain, Size: 1616 bytes --]

On Mon, 18 Aug 2014 19:57:49 -0400 Mike Frysinger <vapier@gentoo.org> wrote:

> On Mon 18 Aug 2014 13:04:35 Steve Dickson wrote:
> > On 08/17/2014 10:44 AM, Mike Frysinger wrote:
> > > If you don't have systemd, then this script dumps:
> > > /usr/sbin/start-statd: line 8: systemctl: command not found
> > > 
> > > This isn't terribly useful since we ultimately fall back to running
> > > the daemon ourselves, so probe for systemd's existence before we try
> > > to use it.
> > > 
> > > Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> > 
> > Committed... but I used 'rpm -q systemd' instead of 'systemctl --help'
> > to test for the existences of systemd
> > 
> >  # First try systemd if it's installed.
> > -if systemctl --help >/dev/null 2>&1; then
> > +if rpm -q systemd > /dev/null 2>&1; then
> >      # Quit only if the call worked.
> >      systemctl start rpc-statd.service && exit
> 
> what about all the other distros not using rpm ?  my version was distro 
> agnostic.
> -mike

distro-agnotic is certainly important.
I would have gone with:

diff --git a/utils/statd/start-statd b/utils/statd/start-statd
index dcdaf7763f18..414f73f58096 100644
--- a/utils/statd/start-statd
+++ b/utils/statd/start-statd
@@ -5,7 +5,7 @@
 # It should run statd with whatever flags are apropriate for this
 # site.
 PATH="/sbin:/usr/sbin:/bin:/usr/bin"
-if systemctl start rpc-statd.service
+if systemctl start rpc-statd.service > /dev/null 2>&1
 then :
 else
     exec rpc.statd --no-notify


why call systemctl twice (once with --help and once with "start")?

NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2014-08-19  1:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-17 14:44 [PATCH nfs-utils] start-statd: clean up output when systemd is not installed Mike Frysinger
2014-08-18 17:04 ` Steve Dickson
2014-08-18 23:57   ` Mike Frysinger
2014-08-19  1:06     ` NeilBrown [this message]
2014-08-19  3:28       ` Mike Frysinger
2014-08-19 14:06     ` Steve Dickson

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=20140819110603.38b92ecb@notabene.brown \
    --to=neilb@suse.de \
    --cc=SteveD@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=vapier@gentoo.org \
    /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).