From: Danny Al-Gaaf Date: Thu, 14 Feb 2013 12:47:02 +0000 (+0100) Subject: ceph_common.sh: check if $sshdir exist, otherwise create it X-Git-Tag: v0.58~70^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=aa4cae66f056e3079902545cae31acfee3509239;p=ceph.git ceph_common.sh: check if $sshdir exist, otherwise create it Check if $sshdir exist. If not, create it before cd to the directory. Signed-off-by: Danny Al-Gaaf --- diff --git a/src/ceph_common.sh b/src/ceph_common.sh index 5e77a175c928..fd3f72f381fc 100644 --- a/src/ceph_common.sh +++ b/src/ceph_common.sh @@ -89,8 +89,8 @@ do_cmd() { sudo su $user -c "$1" || { [ -z "$3" ] && echo "failed: '$1'" && exit 1; } fi else - [ $verbose -eq 1 ] && echo "--- $ssh $2 \"cd $sshdir ; ulimit -c unlimited ; $1\"" - $ssh $2 "cd $sshdir ; ulimit -c unlimited ; $1" || { [ -z "$3" ] && echo "failed: '$ssh $1'" && exit 1; } + [ $verbose -eq 1 ] && echo "--- $ssh $2 \"if [ ! -d $sshdir ]; then mkdir -p $sshdir; fi; cd $sshdir ; ulimit -c unlimited ; $1\"" + $ssh $2 "if [ ! -d $sshdir ]; then mkdir -p $sshdir; fi; cd $sshdir ; ulimit -c unlimited ; $1" || { [ -z "$3" ] && echo "failed: '$ssh $1'" && exit 1; } fi } @@ -105,8 +105,8 @@ do_root_cmd() { sudo bash -c "$1" || { echo "failed: '$1'" ; exit 1; } fi else - [ $verbose -eq 1 ] && echo "--- $rootssh $2 \"cd $sshdir ; ulimit -c unlimited ; $1\"" - $rootssh $2 "cd $sshdir ; ulimit -c unlimited ; $1" || { echo "failed: '$rootssh $1'" ; exit 1; } + [ $verbose -eq 1 ] && echo "--- $rootssh $2 \"if [ ! -d $sshdir ]; then mkdir -p $sshdir; fi ; cd $sshdir ; ulimit -c unlimited ; $1\"" + $rootssh $2 "if [ ! -d $sshdir ]; then mkdir -p $sshdir; fi ; cd $sshdir; ulimit -c unlimited ; $1" || { echo "failed: '$rootssh $1'" ; exit 1; } fi }