Allow use of rsync when fetching logs

Change-Id: I561ae3c9ebe7765d76a0835c712d17e86b731df3
(cherry picked from commit 359f4d84608c44541c43bfc564893ac76c326063)
This commit is contained in:
Jon Hall 2019-01-08 16:17:24 -08:00 committed by Ray Milkey
parent cb4327a09e
commit 27e94e4057
2 changed files with 34 additions and 2 deletions

View File

@ -38,6 +38,22 @@ fi
# Execute the remote commands
for node in $nodes; do
echo "fetching from ${node}..."
USE_RSYNC=${USE_RSYNC:-'false'}
# Check if RSYNC is installed
if [ "$USE_RSYNC" = "true" ]; then
if ssh $ONOS_USER@${node} $SSH_OPTIONS which rsync >&2 > /dev/null; then
echo "Using rsync"
else
echo "Installing rsync"
# TODO check remote OS and use proper method to install rsync
ssh $ONOS_USER@${node} sudo apt-get install -y rsync || USE_RSYNC='false'
fi
fi
mkdir -p ${node}
scp -p $ONOS_USER@[${node}]:$ATOMIX_INSTALL_DIR/log/atomix.log* ./${node}/
if [ "$USE_RSYNC" = "true" ]; then
rsync -avhz --progress [$ONOS_USER@${node}]:$ATOMIX_INSTALL_DIR/log/atomix.log* ./${node}/
else
scp -p $ONOS_USER@[${node}]:$ATOMIX_INSTALL_DIR/log/atomix.log* ./${node}/
fi
done

View File

@ -38,6 +38,22 @@ fi
# Execute the remote commands
for node in $nodes; do
echo "fetching from ${node}..."
USE_RSYNC=${USE_RSYNC:-'false'}
# Check if RSYNC is installed
if [ "$USE_RSYNC" = "true" ]; then
if ssh $ONOS_USER@${node} $SSH_OPTIONS which rsync >&2 > /dev/null; then
echo "Using rsync"
else
echo "Installing rsync"
# TODO check remote OS and use proper method to install rsync
ssh $ONOS_USER@${node} sudo apt-get install -y rsync || USE_RSYNC='false'
fi
fi
mkdir -p ${node}
scp -p $ONOS_USER@[${node}]:$ONOS_INSTALL_DIR/log/karaf.log* ./${node}/
if [ "$USE_RSYNC" = "true" ]; then
rsync -avhz --progress [$ONOS_USER@${node}]:$ONOS_INSTALL_DIR/log/karaf.log* ./${node}/
else
scp -p $ONOS_USER@[${node}]:$ONOS_INSTALL_DIR/log/karaf.log* ./${node}/
fi
done