[PATCH] mkcephfs: Don't transfer absolute path of mkcephfs to other hosts.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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��.n��������+%������w��{.n����z��u���ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f





[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux