Created
January 23, 2018 09:25
-
-
Save adamjakab/059fb733fe3690353de6e5a77b0b7166 to your computer and use it in GitHub Desktop.
RSYNC TO NAS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#PATHS | |
RSYNC="/usr/bin/rsync" | |
SRC="/mnt/storage/data/FOLDER_TO_BACKUP" # !!!NO TRAILING SLASH PLEASE!!! | |
DST="/mnt/autofs/WD-BACKUP-RW/AdamJakab/FOLDER_TO_BACKUP" # !!!NO TRAILING SLASH PLEASE!!! | |
# SET UP VARIABLES FOR CP | |
RSYNC_PATH_SRC="${SRC}/" | |
RSYNC_PATH_DST="${DST}/" | |
# RSYNC OPTIONS | |
OPT="--recursive --times --update --cvs-exclude" | |
OPT=${OPT}" --inplace --one-file-system --stats" | |
OPT=${OPT}" --exclude-from ${RSYNC_PATH_SRC}sync-wdcloud-excludes.txt" | |
OPT=${OPT}" --delete-excluded" | |
# OPT=${OPT}" --delete" | |
# SAY SOMETHING | |
echo "SYNCING(${OPT}): '${RSYNC_PATH_SRC}' -> '${RSYNC_PATH_DST}'" | |
# DO THE JOB | |
${RSYNC} ${OPT} ${RSYNC_PATH_SRC} ${RSYNC_PATH_DST} | |
# RESULT | |
if [ $? -eq 0 ]; then | |
echo "SYNCED SUCCESSFULLY" | |
else | |
echo "SYNCED WITH ERRORS" | |
fi | |
exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###--- LIST OF FILE PATTERNS TO EXCLUDE FROM SYNC---### | |
._* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment