Skip to content

Instantly share code, notes, and snippets.

@sinbadsalmon
Created November 10, 2019 14:05
Show Gist options
  • Save sinbadsalmon/12d864c45b2f64950554b9e93918e296 to your computer and use it in GitHub Desktop.
Save sinbadsalmon/12d864c45b2f64950554b9e93918e296 to your computer and use it in GitHub Desktop.
#!/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