Title: rsync-gial.a-aa5352.sh.2016.10.19
Created: 2018-04-29 22:47:03 +0000
#!/bin/bash
# File: rsync-gial.a-aa5352.sh
# Script to backup project AA5352 to GIAL-A
clear
echo RSYNC SCRIPT TO BACKUP PROJECT AA5352 DIRECTORY TO GIAL-A/RSYNC/2016-C-GIAL-DE-AA_5352_LPDM
echo
date
echo
echo
echo Backing up AA5352 LANGUAGE PROGRAM DESIGN AND MANAGEMENT
echo ========================================================
echo
#
# PART 1
#
SOURCE_DIR="/Volumes/Mg-Projects/Avid_Projects/2016/2016-C-GIAL-DE-AA_5352_LPDM"
DEST_DIR="/Volumes/GIAL-A/rsync/2016-C-GIAL-DE-AA_5352_LPDM/From-Mg-Projects"
ARCHIVE_NAME="$DEST_DIR/`date "+archive-%Y-%m-%d-%H.%M.%S"`"
mkdir "$ARCHIVE_NAME"
echo 'Part 1: Source: '$SOURCE_DIR
echo ' Destination: '$DEST_DIR
echo ' Archive: '$ARCHIVE_NAME
echo
#THIS IS THE LOCAL VERSION:
# DON'T USE --delete (because we are colliating from several directories to here)
# DON'T USE --delete-excluded (because of above and because we are not excluding anything)
sudo /usr/bin/rsync -vaz \
--progress \
--backup \
--backup-dir $ARCHIVE_NAME \
--stats \
--delete \
"$SOURCE_DIR" "$DEST_DIR"
echo
echo
date
# Leave a zero size file with a system timestamp to show when we completed
touch "$DEST_DIR".latest-rsync-date
# Find the size of the archive folder
ARCHIVESIZESPACE=`du -hs $ARCHIVE_NAME | cut -f 1`
#Remove the leading space
ARCHIVESIZE=`echo "${ARCHIVESIZESPACE// /}"`
echo Archive folder size: $ARCHIVESIZE
NEW_NAME=$ARCHIVE_NAME"_("$ARCHIVESIZE")"
echo Renaming archive folder to: $NEW_NAME
mv "$ARCHIVE_NAME" "$NEW_NAME"
echo
#
# PART 2
#
SOURCE_DIR="/Volumes/Mg-SSD-Media/Linked_Media/2016-C-GIAL-DE-AA_5352_LPDM"
DEST_DIR="/Volumes/GIAL-A/rsync/2016-C-GIAL-DE-AA_5352_LPDM/From-Mg-SSD-Media/Linked_Media"
ARCHIVE_NAME="$DEST_DIR/`date "+archive-%Y-%m-%d-%H.%M.%S"`"
mkdir "$ARCHIVE_NAME"
echo
echo 'Part 2: Source: '$SOURCE_DIR
echo ' Destination: '$DEST_DIR
echo ' Archive: '$ARCHIVE_NAME
echo
#THIS IS THE LOCAL VERSION:
# DON'T USE --delete (because we are colliating from several directories to here)
# DON'T USE --delete-excluded (because of above and because we are not excluding anything)
sudo /usr/bin/rsync -vaz \
--progress \
--backup \
--backup-dir $ARCHIVE_NAME \
--stats \
--delete \
"$SOURCE_DIR" "$DEST_DIR"
echo
echo
date
# Leave a zero size file with a system timestamp to show when we completed
touch "$DEST_DIR".latest-rsync-date
# Find the size of the archive folder
ARCHIVESIZESPACE=`du -hs $ARCHIVE_NAME | cut -f 1`
#Remove the leading space
ARCHIVESIZE=`echo "${ARCHIVESIZESPACE// /}"`
echo Archive folder size: $ARCHIVESIZE
NEW_NAME=$ARCHIVE_NAME"_("$ARCHIVESIZE")"
echo Renaming archive folder to: $NEW_NAME
mv "$ARCHIVE_NAME" "$NEW_NAME"
echo
#
# PART 3
#
SOURCE_DIR="/Volumes/Mg-SSD-Media/Avid MediaFiles"
DEST_DIR="/Volumes/GIAL-A/rsync/2016-C-GIAL-DE-AA_5352_LPDM/From-Mg-SSD-Media/AvidMediaFiles"
ARCHIVE_NAME="$DEST_DIR/`date "+archive-%Y-%m-%d-%H.%M.%S"`"
mkdir "$ARCHIVE_NAME"
echo
echo 'Part 3: Source: '$SOURCE_DIR
echo ' Destination: '$DEST_DIR
echo ' Archive: '$ARCHIVE_NAME
echo
#THIS IS THE LOCAL VERSION:
# DON'T USE --delete (because we are colliating from several directories to here)
# DON'T USE --delete-excluded (because of above and because we are not excluding anything)
sudo /usr/bin/rsync -vaz \
--progress \
--backup \
--backup-dir $ARCHIVE_NAME \
--stats \
--delete \
"$SOURCE_DIR" "$DEST_DIR"
echo
echo
date
# Leave a zero size file with a system timestamp to show when we completed
touch "$DEST_DIR".latest-rsync-date
# Find the size of the archive folder
ARCHIVESIZESPACE=`du -hs $ARCHIVE_NAME | cut -f 1`
#Remove the leading space
ARCHIVESIZE=`echo "${ARCHIVESIZESPACE// /}"`
echo Archive folder size: $ARCHIVESIZE
NEW_NAME=$ARCHIVE_NAME"_("$ARCHIVESIZE")"
echo Renaming archive folder to: $NEW_NAME
mv "$ARCHIVE_NAME" "$NEW_NAME"
echo
#
# PART 4
#
SOURCE_DIR="/Users/Shared/AvidMediaComposer/Avid Attic"
DEST_DIR="/Volumes/GIAL-A/rsync/2016-C-GIAL-DE-AA_5352_LPDM/From-Mg-SSD"
ARCHIVE_NAME="$DEST_DIR/`date "+archive-%Y-%m-%d-%H.%M.%S"`"
mkdir "$ARCHIVE_NAME"
echo
echo 'Part 4: Source: '$SOURCE_DIR
echo ' Destination: '$DEST_DIR
echo ' Archive: '$ARCHIVE_NAME
echo
#THIS IS THE LOCAL VERSION:
# DON'T USE --delete (because we are colliating from several directories to here)
# DON'T USE --delete-excluded (because of above and because we are not excluding anything)
sudo /usr/bin/rsync -vaz \
--progress \
--backup \
--backup-dir $ARCHIVE_NAME \
--stats \
--delete \
"$SOURCE_DIR" "$DEST_DIR"
echo
echo
date
# Leave a zero size file with a system timestamp to show when we completed
touch "$DEST_DIR".latest-rsync-date
# Find the size of the archive folder
ARCHIVESIZESPACE=`du -hs $ARCHIVE_NAME | cut -f 1`
#Remove the leading space
ARCHIVESIZE=`echo "${ARCHIVESIZESPACE// /}"`
echo Archive folder size: $ARCHIVESIZE
NEW_NAME=$ARCHIVE_NAME"_("$ARCHIVESIZE")"
echo Renaming archive folder to: $NEW_NAME
mv "$ARCHIVE_NAME" "$NEW_NAME"
echo
#
# END
#
date
echo
exit 0