forked from HawksRepos/PTS-Team
-
Notifications
You must be signed in to change notification settings - Fork 55
Plex fast BACKUP
PhysK edited this page Jan 22, 2020
·
1 revision
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
Wiki - Wiki
- Recommended Pre-Reading
- Server - Storage Planning
- Usenet or BitTorrent
- PTS Editions
- PTS Folder Structure
- PTS-Repos
- Common Issues
Data Transport
- Traefik
- Port Guard
- PTS Shield
- PTS Press
- Google Cloud - GCE
- Hetzner Cloud
- PTS Fork
- Extra PTS Commands
- PTS Vault - Data Storage
- PTSPatrol
- Plex AutoScan in Docker Container
- Plex_Dupefiner
- Traktarr
- System & Network Auditor
- PreInstaller & UnInstaller
Core Apps [Expand]
Community Apps [Expand]
- AirSonic
- Bazarr
- Bitwarden
- BookSonic
- cAdvisor
- Cloud Commander
- Deluge
- DelugeVPN
- Dozzle
- Duplicati
- Filebrowser
- FlexGet
- Gazee
- Headphones
- Heimdall
- HomeAssistant
- jd2-openvpn
- Kitana
- Logarr
- MakeMKV
- MariaDB
- McMyadmin
- MEDUSA
- Mellow
- Miniflux
- Monitorr
- Muximux
- Mylar
- NextCloud
- NowShowing
- NZBHydra2
- Organizr
- plpp
- pyLoad
- qBittorrent
- QBittorrent VPN
- radarrsyncarr
- Resilio
- rflood-openvpn
- rutorrent-openvpn
- Shoko Anime Server
- SpeedTest
- SyncLounge
- Teamspeak3
- The Lounge
- Transmission
- Trakt.or
- Ubooquity
- Varken
- vnc-xfce
- vnstat
- ZeroTier