2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-09-02 00:08:20 +00:00
Files
xcat-core/xCAT/postscripts/syncfiles
yangsong 7c85b0998d add support for syncfiles with scp (#5123)
* add support for syncfiles with scp

* refine logic of EXECTUTE support message non rsync filesync

* refine syncfiles

* add startsyncfile script for cumulus

* refine format, fix updatenode without options causes command to crash #5142
2018-04-27 11:28:08 +08:00

79 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
# IBM(c) 2009 EPL license http://www.eclipse.org/legal/epl-v10.html
#####################################################
#
# Initiate the xdcp from Mangement node to sync
# files to this node
#
#####################################################
#statelite does not support syncfiles
if [ -d /.statelite ]; then
echo "Statelite does not support syncfiles, nothing to do..."
logger -t xcat -p local4.info "Statelite does not support syncfiles, nothing to do..."
exit 0
fi
# do nothing when UPDATENODE=1 because it is done from the top down
if [ -n "$UPDATENODE" ] && [ $UPDATENODE -eq 1 ]; then
#echo " Did not sync any files. Use updatenode -F to sync the files."
logger -t xcat -p local4.err "$0: Did not sync any files. Use updatenode -F to sync the files."
exit 0
fi
#do nothing id there is no sync file template for the node
if [ -n "$NOSYNCFILES" ] && [ $NOSYNCFILES -eq 1 ]; then
echo " Did not sync any files."
logger -t xcat -p local4.err "$0: there is no sync file template for the node"
exit 0
fi
RCP=
if [ ! -e "/usr/bin/rsync" ]; then
[ -e "/usr/bin/scp" ] && RCP="/usr/bin/scp"
fi
logger -t xcat -p local4.info "Performing syncfiles postscript"
osname=`uname`
# run the xdcp on the MN/SN
xcatpostdir="/xcatpost"
logger -t xcat -p local4.info "$0: the OS name = $osname"
quit="no"
count=5
returncode=0
while [ $quit = "no" ]; do
if cat /etc/os-release |grep -i cumulus >/dev/null 2>&1; then
RCP=$RCP $xcatpostdir/startsyncfiles
returncode=$?
elif [ $osname = "Linux" ]
then
`$xcatpostdir/startsyncfiles.awk -v RCP=$RCP`
returncode=$?
elif [ $osname = "AIX" ]
then
`$xcatpostdir/startsyncfiles.aix`
returncode=$?
fi
if [ $returncode -eq 0 ] || [ $count -eq 0 ]; then
quit="yes"
else
let SLI=$RANDOM%10
let SLI=SLI+10
sleep $SLI
fi
let count=count-1
done
if [ $returncode -eq 0 ]
then
logger -t xcat -p local4.info "$0: Perform Syncing File action successfully"
else
logger -t xcat -p local4.err "$0: Perform Syncing File action encountered error"
fi
[ $returncode -eq 0 ]