Skip to content
PhysK edited this page Jan 22, 2020 · 1 revision

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

Useful Starter Links

  1. Introduction
  2. G-Suite Signup
  3. Recommended NewsHosts
  4. Change Log

Prior Planning 101

  1. Recommended Pre-Reading
  2. Server - Storage Planning
  3. Usenet or BitTorrent
  4. PTS Editions
  5. PTS Folder Structure
  6. PTS-Repos
  7. Common Issues

Deploy & Config

PTS-Team
  1. SSH Server Access
  2. Install PTS
  3. WatchTower
  4. Remote Path Mappings

Data Transport
  1. PTS Clone
    1. Google OAuth Keys
    2. PTS Move
    3. PTS Blitz
    4. 2nd HD Option

Key Components

  1. Traefik
  2. Port Guard
  3. PTS Shield
  4. PTS Press
  5. Google Cloud - GCE
    1. Automated setup
  6. Hetzner Cloud
  7. PTS Fork
  8. Extra PTS Commands

Blitz App Info

  1. Accessing PTS Apps
  2. App Port Scheme

Tools & Services

Core Apps [Expand]
  1. Emby
  2. Jackett
  3. Jellyfin
  4. LazyLibrarian
  5. Lidarr
  6. Netdata
  7. NZBGet
  8. Ombi
  9. Plex
  10. Portainer
  11. qBittorrent
  12. Radarr
  13. Radarr4k
  14. RadarrHDR
  15. RuTorrent
  16. SABnzbd
  17. Sonarr
  18. Sonarr4k
  19. SonarrHDR
  20. Tautulli
  21. JDownloader2
Community Apps [Expand]
  1. AirSonic
  2. Bazarr
  3. Bitwarden
  4. BookSonic
  5. cAdvisor
  6. Cloud Commander
  7. Deluge
  8. DelugeVPN
  9. Dozzle
  10. Duplicati
  11. Filebrowser
  12. FlexGet
  13. Gazee
  14. Headphones
  15. Heimdall
  16. HomeAssistant
  17. jd2-openvpn
  18. Kitana
  19. Logarr
  20. MakeMKV
  21. MariaDB
  22. McMyadmin
  23. MEDUSA
  24. Mellow
  25. Miniflux
  26. Monitorr
  27. Muximux
  28. Mylar
  29. NextCloud
  30. NowShowing
  31. NZBHydra2
  32. Organizr
  33. plpp
  34. pyLoad
  35. qBittorrent
  36. QBittorrent VPN
  37. radarrsyncarr
  38. Resilio
  39. rflood-openvpn
  40. rutorrent-openvpn
  41. Shoko Anime Server
  42. SpeedTest
  43. SyncLounge
  44. Teamspeak3
  45. The Lounge
  46. Transmission
  47. Trakt.or
  48. Ubooquity
  49. Varken
  50. vnc-xfce
  51. vnstat
  52. ZeroTier

Misc Info & Articles

  1. Change Server Time
  2. Fail2Ban
  3. Custom Containers
  4. Deploying Varken, Influx, Telegraf, Grafana
  5. cloneclean commands
  6. Understanding htop
Scripts
  1. Scripting Area
    1. Auto Upload for Sonarr and Lidarr
    2. Auto Delete Log
    3. Plex Plugin DB Backup
    4. Plex fast BACKUP
    5. Delete All Unmonitored from Radarr
Clone this wiki locally