From patchwork Thu Oct 21 16:32:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Schutt X-Patchwork-Id: 271671 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9LGWasQ007690 for ; Thu, 21 Oct 2010 16:32:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751847Ab0JUQcf (ORCPT ); Thu, 21 Oct 2010 12:32:35 -0400 Received: from sentry-three.sandia.gov ([132.175.109.17]:51878 "EHLO sentry-three.sandia.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751011Ab0JUQce (ORCPT ); Thu, 21 Oct 2010 12:32:34 -0400 X-WSS-ID: 0LANFA6-0C-6WC-02 X-M-MSG: Received: from sentry.sandia.gov (sentry.sandia.gov [132.175.109.21]) by sentry-three.sandia.gov (Postfix) with ESMTP id 15B864DB9D3 for ; Thu, 21 Oct 2010 10:32:30 -0600 (MDT) Received: from [132.175.109.1] by sentry.sandia.gov with ESMTP (SMTP Relay 01 (Email Firewall v6.3.2)); Thu, 21 Oct 2010 10:32:14 -0600 X-Server-Uuid: 6BFC7783-7E22-49B4-B610-66D6BE496C0E Received: from localhost.localdomain (skynetcore2.sandia.gov [134.253.138.21]) by mailgate.sandia.gov (8.14.4/8.14.4) with ESMTP id o9LGW2v8013596; Thu, 21 Oct 2010 10:32:03 -0600 From: "Jim Schutt" To: ceph-devel@vger.kernel.org cc: "Jim Schutt" Subject: [PATCH] init-ceph: Make sure daemon_is_running() checks the correct instance Date: Thu, 21 Oct 2010 10:32:09 -0600 Message-ID: <1287678729-14132-1-git-send-email-jaschut@sandia.gov> X-Mailer: git-send-email 1.6.6 X-PMX-Version: 5.6.0.2009776, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2010.10.21.162415 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1600_1699 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DATE_TZ_NA 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __MIME_TEXT_ONLY 0, __SANE_MSGID 0, __STOCK_PHRASE_7 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_PATH 0, __URI_NO_WWW 0, __URI_NS ' X-TMWD-Spam-Summary: TS=20101021163216; ID=1; SEV=2.3.1; DFV=B2010102116; IFV=NA; AIF=B2010102116; RPD=5.03.0010; ENG=NA; RPDID=7374723D303030312E30413031303230332E34434330364231302E303134313A534346535441543838363133332C73733D312C6667733D30; CAT=NONE; CON=NONE; SIG=AAAAAAAAAAAAAAAAAAAAAAAAfQ== X-MMS-Spam-Filter-ID: B2010102116_5.03.0010 MIME-Version: 1.0 X-WSS-ID: 60DEB4843KK1068551-01-01 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 21 Oct 2010 16:32:36 +0000 (UTC) diff --git a/src/init-ceph.in b/src/init-ceph.in index 52891c0..d42a806 100644 --- a/src/init-ceph.in +++ b/src/init-ceph.in @@ -69,10 +69,11 @@ signal_daemon() { daemon_is_running() { name=$1 daemon=$2 - pidfile=$3 + daemon_id=$3 + pidfile=$4 do_cmd "[ -e $pidfile ] || exit 1 # no pid, presumably not running pid=\`cat $pidfile\` - [ -e /proc/\$pid ] && grep -q $daemon /proc/\$pid/cmdline && exit 0 # running + [ -e /proc/\$pid ] && grep -q $daemon /proc/\$pid/cmdline && grep -qwe -i.$daemon_id /proc/\$pid/cmdline && exit 0 # running exit 1 # pid is something else" "" "okfail" } @@ -195,7 +196,7 @@ for name in $what; do # start, and already running? (do this check early to avoid unnecessary work!) if [ "$command" = "start" ]; then - if daemon_is_running $name c$type $pid_file; then + if daemon_is_running $name c$type $id $pid_file; then echo "Starting Ceph $name on $host...already running" continue fi