Skip to content

Plex fast BACKUP

MrDoobPG edited this page Jun 28, 2019 · 6 revisions

📂 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

  1. Intro
  2. Script


1. Intro

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:

  1. Stop the Plex docker

  2. Create the backup and compressed file with tar + pigz

  3. Restart Plex Docker

  4. Send backup to Google Drive

  5. Remove local backup

You can add this script to crontab.

2. Script

# 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

Installing PlexGuide

  1. PlexGuide Install Information

Preplanning & Information

  1. PG Folder Structure

Domain and Port Control

  1. CloudFlare Tunnel

Primary Applications

  1. Plex

Useful Links

  1. PG YouTube Channel
Clone this wiki locally