Skip to content

Instantly share code, notes, and snippets.

@priancho
Created August 22, 2019 07:24
Show Gist options
  • Save priancho/2bea521edbbd0370589432cb527f2b43 to your computer and use it in GitHub Desktop.
Save priancho/2bea521edbbd0370589432cb527f2b43 to your computer and use it in GitHub Desktop.
rsync backup script template
#!/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