initscripts: make do_cmd properly bail when command fails

And print what command it was that failed.
This commit is contained in:
Sage Weil 2009-03-24 12:55:01 -07:00
parent 565dae5e4d
commit 4160adcbfa

View File

@ -45,9 +45,9 @@ do_cmd() {
[ $verbose -eq 1 ] && echo "--- $host:$dir# $1"
if [ -z "$ssh" ]; then
ulimit -c unlimited
bash -c "$1" || (echo failed. ; exit 1)
bash -c "$1" || { echo "failed: '$1'" ; exit 1; }
else
$ssh "cd $dir ; ulimit -c unlimited ; $1" || (echo failed. ; exit 1)
$ssh "cd $dir ; ulimit -c unlimited ; $1" || { echo "failed: '$ssh $1'" ; exit 1; }
fi
}