From patchwork Tue Aug 19 01:06:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 4739851 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 80A469F39D for ; Tue, 19 Aug 2014 01:06:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DD55E20125 for ; Tue, 19 Aug 2014 01:06:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2538F20123 for ; Tue, 19 Aug 2014 01:06:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752380AbaHSBGO (ORCPT ); Mon, 18 Aug 2014 21:06:14 -0400 Received: from cantor2.suse.de ([195.135.220.15]:41420 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752351AbaHSBGO (ORCPT ); Mon, 18 Aug 2014 21:06:14 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4FE23AD1B; Tue, 19 Aug 2014 01:06:12 +0000 (UTC) Date: Tue, 19 Aug 2014 11:06:03 +1000 From: NeilBrown To: Mike Frysinger Cc: Steve Dickson , linux-nfs@vger.kernel.org Subject: Re: [PATCH nfs-utils] start-statd: clean up output when systemd is not installed Message-ID: <20140819110603.38b92ecb@notabene.brown> In-Reply-To: <1649346.61nAovKFdn@vapier> References: <1408286648-19031-1-git-send-email-vapier@gentoo.org> <53F23223.5090904@RedHat.com> <1649346.61nAovKFdn@vapier> X-Mailer: Claws Mail 3.10.1-123-gae895c (GTK+ 2.24.22; x86_64-suse-linux-gnu) MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Mon, 18 Aug 2014 19:57:49 -0400 Mike Frysinger 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 > > > > 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: why call systemctl twice (once with --help and once with "start")? NeilBrown 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