All of lore.kernel.org
 help / color / mirror / Atom feed
From: majianpeng <majianpeng@gmail.com>
To: sage <sage@inktank.com>
Cc: ceph-devel <ceph-devel@vger.kernel.org>
Subject: [PATCH] mkcephfs: Don't transfer absolute path of mkcephfs to other hosts.
Date: Wed, 6 Nov 2013 09:25:09 +0800	[thread overview]
Message-ID: <201311060925048528111@gmail.com> (raw)

When exec 'mkcephfs -a -c ceph.conf',it will transfer absolute path of
mkcephfs to other hosts.But for different hosts, the path of mkcephfs
may different.It will make the command error.The error message is
"bash: ./mkcephfs: No such file or directory".
So we should transfer the name mkcephfs to other hosts.It those hosts,it
will automaicly search by PATH.

Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
---
 src/mkcephfs.in | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/mkcephfs.in b/src/mkcephfs.in
index 2838568..c5e41d9 100644
--- a/src/mkcephfs.in
+++ b/src/mkcephfs.in
@@ -455,6 +455,7 @@ fi
 ### do everything via ssh ###
 
 if [ $allhosts -eq 1 ]; then
+    localhost=$hostname
 
     verify_conf
 
@@ -498,10 +499,18 @@ if [ $allhosts -eq 1 ]; then
 	fi
 	
 	if [ $mkfs -eq 1 ] && [ "$type" = "osd" ]; then
-	    do_root_cmd "$0 -d $rdir --prepare-osdfs $name"
+		if [ $localhost = $host ]; then
+		    do_root_cmd "$0 -d $rdir --prepare-osdfs $name"
+		else
+		    do_root_cmd "$(basename $0) -d $rdir --prepare-osdfs $name"
+		fi
 	fi
 
-	do_root_cmd "$0 -d $rdir --init-daemon $name"
+	if [ $localhost = $host ]; then
+	    do_root_cmd "$0 -d $rdir --init-daemon $name"
+	else
+	    do_root_cmd "$(basename $0) -d $rdir --init-daemon $name"
+	fi
 
 	# collect the key
 	if [ -n "$ssh" ]; then
@@ -544,7 +553,11 @@ if [ $allhosts -eq 1 ]; then
 	    fi
 	fi
 	
-	do_root_cmd "$0 -d $rdir --init-daemon $name"
+	if [ $localhost = $host ]; then
+	    do_root_cmd "$0 -d $rdir --init-daemon $name"
+	else
+	    do_root_cmd "$(basename $0) -d $rdir --init-daemon $name"
+	fi
 
 	if [ -n "$ssh" ]; then
 	    #cleanup no longer need rdir
-- 
1.8.4

             reply	other threads:[~2013-11-06  1:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-06  1:25 majianpeng [this message]
2013-11-06  2:20 ` [PATCH] mkcephfs: Don't transfer absolute path of mkcephfs to other hosts Yunchuan Wen

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=201311060925048528111@gmail.com \
    --to=majianpeng@gmail.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=sage@inktank.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.