From patchwork Sun Aug 17 14:44:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 4731311 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 50D629F344 for ; Sun, 17 Aug 2014 14:44:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 88D852012D for ; Sun, 17 Aug 2014 14:44:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 75BEB200E7 for ; Sun, 17 Aug 2014 14:44:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751719AbaHQOoO (ORCPT ); Sun, 17 Aug 2014 10:44:14 -0400 Received: from smtp.gentoo.org ([140.211.166.183]:43741 "EHLO smtp.gentoo.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751714AbaHQOoN (ORCPT ); Sun, 17 Aug 2014 10:44:13 -0400 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 19EA8340004 for ; Sun, 17 Aug 2014 14:44:08 +0000 (UTC) From: Mike Frysinger To: linux-nfs@vger.kernel.org Subject: [PATCH nfs-utils] start-statd: clean up output when systemd is not installed Date: Sun, 17 Aug 2014 10:44:08 -0400 Message-Id: <1408286648-19031-1-git-send-email-vapier@gentoo.org> X-Mailer: git-send-email 2.0.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, 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 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 --- utils/statd/start-statd | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) mode change 100644 => 100755 utils/statd/start-statd diff --git a/utils/statd/start-statd b/utils/statd/start-statd old mode 100644 new mode 100755 index dcdaf77..ec9383b --- a/utils/statd/start-statd +++ b/utils/statd/start-statd @@ -1,12 +1,16 @@ -#!/bin/bash -p +#!/bin/sh # nfsmount calls this script when mounting a filesystem with locking # enabled, but when statd does not seem to be running (based on # /var/run/rpc.statd.pid). # 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 -then : -else - exec rpc.statd --no-notify + +# First try systemd if it's installed. +if systemctl --help >/dev/null 2>&1; then + # Quit only if the call worked. + systemctl start rpc-statd.service && exit fi + +# Fall back to launching it ourselves. +exec rpc.statd --no-notify