set -xuve

#
# Architecture
#

PROJDIR=%PROJDIR%
HPCPROJ=%HPCPROJ%
HPCUSER=%HPCUSER%
HPCHOST=%HPCHOST%
EXPID=%EXPID%
ROOTDIR=%CURRENT_ROOTDIR%

SRC_SYNC_DIR=${PROJDIR}
DST_SYNC_DIR=${HPCUSER}@${HPCHOST}:/gpfs/scratch/${HPCPROJ}/${HPCUSER}/${EXPID}/
# Check that the remote directory exists and create it if necessary
ssh ${HPCUSER}@${HPCHOST} "mkdir -p ${DST_SYNC_DIR}"

rsync --recursive --links --perms --times --owner --devices --specials --verbose ${SRC_SYNC_DIR} ${DST_SYNC_DIR}

echo "SYNCHRONIZE Done."