-
Notifications
You must be signed in to change notification settings - Fork 257
Plex fast BACKUP
📂 Click Here - Sign up for Google's Suite for Business - Unlimited Space
📂 Click Here - NZB's with from NewsHost - PG Members Receive a 58% Discount
Table of Contents
The purpose of this script is to do faster backups of plex database, by using all the CPU resources of the system. This script is particularly useful for systems with several CPUs/cores as it can take advantage of all of them.
The backup is also sent to Google Drive.
In the script below, you just have to replace the variables with your custom paths.
The process is:
-
Stop the Plex docker
-
Create the backup and compressed file with tar + pigz
-
Restart Plex Docker
-
Send backup to Google Drive
-
Remove local backup
You can add this script to crontab.
# autoplexbackup.sh
# !/bin/bash
# Automatic Backup Plex and sync to Google Cloud Drive
# Variables
local_backups=/mnt/BACKUPS
remote=gdrive
remote_backups=BACKUPS
useragent="$(cat /var/plexguide/uagent)"
# Stop Plex
sudo docker stop plex
sleep 2s
# Backup Plex database
tar cf - "/opt/appdata/plex" -P | pigz > "$local_backups/$(date +%F-%R)-PlexBackup.tar.gz"
sleep 2s
# Restart Plex
sudo docker start plex
sleep 2s
# Send backup to Google Drive
rclone --config "/opt/appdata/plexguide/rclone.conf" copy "$local_backups" "$remote:$remote_backups" --user-agent="$useragent"
# Remove local backup
rm -rv $local_backups/*
crontab add
sudo sed -i '$a\@weekly bash /the/path/for/script/autoplexbackup.sh\' /var/spool/cron/crontabs/root
📂 Click Here - NZB's from USENET Server - PG Members Receive a 60% Discount
Home - https://plexguide.com