Created
November 10, 2019 14:05
-
-
Save sinbadsalmon/12d864c45b2f64950554b9e93918e296 to your computer and use it in GitHub Desktop.
This file contains 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 | |
# USER AND TARGET DIRECTORY | |
user=youruser | |
backups=/your/chosen/backup/directory/plex_backups | |
# SOURCE DIRECTORY FOR BACKUP | |
SOURCE_DIR='/your/source/directory' | |
if [[ $EUID > 0 ]] | |
then echo "Please run as root" | |
exit | |
fi | |
# if there is no backups directory then create it | |
if [ ! -d $backups ] | |
then | |
mkdir $backups | |
chown $user:$user $backups | |
fi | |
# Rsync | |
echo "Backing up $SOURCE_DIR... | |
rsync -v $SOURCE_DIR $backups | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment