1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-10-20 00:09:21 +03:00
Files
mariadb-columnstore-engine/utils/prat/copy2here.sh
2016-05-31 16:40:30 -05:00

50 lines
1.5 KiB
Bash

#!/bin/sh
#
#/*******************************************************************************
#* Script Name: copy2here.sh
#* Date Created: 2009.03.10
#* Author: Calpont Corp.
#* Purpose: copy the data files to calling host for archiving
#*
#* Parameters: None
#*
#******************************************************************************/
CTOOLS=/usr/local/mariadb/columnstore/tools
localhost=$(hostname -s)
#
if [ -f /tmp/.prat/.hostlist2.txt ]; then
sc=`wc -l < /tmp/.prat/.hostlist2.txt`
else
sc=0
fi
rc=1
cat /tmp/hostlist.txt |
while read moduletype hostname hostdir; do
if [ $hostname = $localhost ]; then
cp /tmp/hostlist.txt $CTOOLS/data/$hostdir
cp /tmp/pratinput.txt $CTOOLS/data/$hostdir
echo Creating tar file on local host $localhost
tarfile=$hostdir.tar
cd $CTOOLS/data
tar -cf $tarfile $hostdir
elif [ $rc -lt $sc ]; then
rc=$sc
cat /tmp/.prat/.hostlist2.txt |
while read servername srvpwd hostdir; do
if [ $servername != $localhost ]; then
echo Collecting files on remote host $servername
echo " and copying them to this server"
tarfile=$hostdir.tar
/usr/local/mariadb/columnstore/bin/remote_command.sh $servername $srvpwd "$CTOOLS/tarfiles.sh $hostdir $tarfile"
cd $CTOOLS/data
/usr/local/mariadb/columnstore/bin/remote_scp_get.sh $servername $srvpwd $CTOOLS/data/$tarfile
fi
done
fi
done
#
# End of script