Created
August 22, 2019 07:24
-
-
Save priancho/2bea521edbbd0370589432cb527f2b43 to your computer and use it in GitHub Desktop.
rsync backup script template
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 | |
# replace ${} with real names | |
PROJECT_NAME=[project name] | |
USER=[user name] | |
SRC_SERVER=[hostname having the original data] | |
SRC_DIR=[path to the original data] | |
DST_DIR=[path to archive data] | |
LOG=[path to the log file] | |
echo "[$(date -Iseconds)] Start: $PROJECT_NAME" 2>&1 | tee -a $LOG | |
rsync -av $USER@$SRC_SERVER:$SRC_DIR $DST_DIR | |
echo "[$(date -Iseconds)] Finish: $PROJECT_NAME" 2>&1 | tee -a $LOG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment