]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
init-ceph: replace 'echo -n' with printf
authorYan, Zheng <zyan@redhat.com>
Thu, 23 Jul 2015 02:58:05 +0000 (10:58 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 31 Aug 2015 08:00:24 +0000 (16:00 +0800)
'echo -n' is no portable. On OSX, output of 'echo -n' can be '-n'

Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/ceph_common.sh
src/init-ceph.in

index 07faddc2fce142b9ad1ae44bad417d3af15aab8a..0a4ac229f5b5631deaf09ad347aea49d036b56e3 100644 (file)
@@ -220,10 +220,10 @@ get_conf() {
 
        if [ -z "$1" ]; then
            [ "$verbose" -eq 1 ] && echo "$CCONF -c $conf -n $type.$id \"$key\""
-           eval "$var=\"`$CCONF -c $conf -n $type.$id \"$key\" || eval echo -n \"$def\"`\""
+           eval "$var=\"`$CCONF -c $conf -n $type.$id \"$key\" || printf \"$def\"`\""
        else
            [ "$verbose" -eq 1 ] && echo "$CCONF -c $conf -s $1 \"$key\""
-           eval "$var=\"`$CCONF -c $conf -s $1 \"$key\" || eval echo -n \"$def\"`\""
+           eval "$var=\"`$CCONF -c $conf -s $1 \"$key\" || eval printf \"$def\"`\""
        fi
 }
 
index 3e3b3a44cd5d3f4b8322d00fc0612162d3d4a20b..82a4fd5e889c63613f520b6103a594c106478a94 100755 (executable)
@@ -59,12 +59,12 @@ signal_daemon() {
     signal=$4
     action=$5
     [ -z "$action" ] && action="Stopping"
-    echo -n "$action Ceph $name on $host..."
+    printf "$action Ceph $name on $host..."
     do_cmd "if [ -e $pidfile ]; then
         pid=`cat $pidfile`
         if [ -e /proc/\$pid ] && grep -q $daemon /proc/\$pid/cmdline ; then
            cmd=\"kill $signal \$pid\"
-           echo -n \$cmd...
+           printf \"\$cmd...\"
            \$cmd
         fi
     fi"
@@ -89,12 +89,12 @@ stop_daemon() {
     signal=$4
     action=$5
     [ -z "$action" ] && action="Stopping"
-    echo -n "$action Ceph $name on $host..."
+    printf "$action Ceph $name on $host..."
     do_cmd "if [ -e $pidfile ] ; then 
        pid=\`cat $pidfile\`
        while [ -e /proc/\$pid ] && grep -q $daemon /proc/\$pid/cmdline ; do
            cmd=\"kill $signal \$pid\"
-           echo -n \$cmd...
+           printf \"\$cmd...\"
            \$cmd
            sleep 1
            continue
@@ -428,7 +428,7 @@ for name in $what; do
 
        status)
            if daemon_is_running $name ceph-$type $id $pid_file; then
-               echo -n "$name: running "
+               printf "$name: running "
                do_cmd "$BINDIR/ceph --admin-daemon $asok version 2>/dev/null" || echo unknown
             elif [ -e "$pid_file" ]; then
                 # daemon is dead, but pid file still exists