From 5a5fcdabd0e05b1d7dd9dd8501a76d437b1414df Mon Sep 17 00:00:00 2001
From: wallacebrf <62187108+wallacebrf@users.noreply.github.com>
Date: Sat, 18 Mar 2023 13:25:50 -0500
Subject: [PATCH] Update README.md
---
README.md | 180 +++++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 164 insertions(+), 16 deletions(-)
diff --git a/README.md b/README.md
index a36506a..f3790f4 100644
--- a/README.md
+++ b/README.md
@@ -1,30 +1,178 @@
-# plex_backup
+
+
-This scrip automatically backups PLEX on a synology (DSM6 and DSM7).
-the script first terminates any active streams with a message "PLEX_Backup_Process_In_Progress" to any active users that a backup is happening.
-Note, if a different message is desrired, ensure it has no spaces or it will not work.
-the script then shuts down plex (it a good idea to always shut down an app when backing up data base files to prevent the database being written to in the middle of a copy)
+
+
-makes a .tar file of the directory
+Synology Native/DOCKER PLEX Installation Automatic Backup
-moves the .tar to a final archiving directory of your choosing
+
+ This project is comprised of a shell script that stops any active PLEX streams, shutdown PLEX, makes a .tar backup file, and restarts PLEX
+
+ Explore the docs »
+
+
+ Report Bug
+ ·
+ Request Feature
+
+
-restarts plex
-the primary user controllable variables are:
+
+
+ Table of Contents
+
+ -
+ About The Project
+
+
+ -
+ Getting Started
+
+
+ - Usage
+ - Road map
+ - Contributing
+ - License
+ - Contact
+ - Acknowledgments
+
+
+
+
+
+
+### About_the_project_Details
+
+The script is written around the Synology NAS DSM operating system Native installation of PLEX or a DOCKER installation on PLEX
+
+(back to top)
+
+
+
+## Getting Started
+
+### Prerequisites
+
+1. This script can be run through Synology Task Scheduler.
+
+### Installation
+
+1. Create the following directories on the NAS
+
+```
+1. /volume1/[shared_foler_name]/logging
+2. /volume1/[shared_foler_name]/logging/notifications
+```
+Ensure ```[shared_foler_name]``` is properly set a folder of your choice
+
+2. Place the ```plex_backup.sh``` file in the ```/logging``` directory
+
+### Configuration "plex_backup.sh"
+
+1. Open the ```plex_backup.sh``` file in a text editor.
+2. the script contains the following configuration variables
+```
#plex variables
plex_backup_dir="/volume1/Server2/Backups/Plex"
PMS_IP='192.168.1.200'
plex_installed_volume="volume1"
-log_file_location="/volume1/web/logging/notifications/plex_docker_backup.txt"
+log_file_location="/volume1/[shared_foler_name]/logging/notifications/plex_backup.txt"
+lock_file_location="/volume1/[shared_foler_name]/logging/notifications/plex_backup.lock"
+installation_type=0 #0 for native plex app, 1 for DOCKER
+
+
+#if using docker edit these parameters, otherwise they can be ignored.
+docker_container_name="plex" #edit to match the name of your PLEX docker container
+plex_library_directory_location="/$plex_installed_volume/Plex"
+folder_name_to_backup="AppData"
+plex_Preferences_loction="PlexMediaServer/AppData/Plex Media Server/Preferences.xml"
+```
+
+```plex_backup_dir``` is where the .tar backup file will be stored
+
+```PMS_IP``` mujst be the IP address used to access PLEX so the script can terminate any active streams
+
+```plex_installed_volume``` which volume on the Synology NAS is the PLEX data directory located
+
+```log_file_location``` where the log file of the backup process will be saved. Ensure ```[shared_foler_name]``` is properly set a folder of your choice
+
+```lock_file_location``` where a lock file will be saved while the script is running. Ensure ```[shared_foler_name]``` is properly set a folder of your choice. this prevents more than once instance of this script from running at once
+
+```installation_type``` indicates if this is a PLEX installation using the native plex installer and package manager or if using docker.
+
+
+
+```docker_container_name``` if using docker, what is the name of the PLEX container within docker
+
+```plex_library_directory_location``` if using docker, where is the PLEX data folder located?
+
+```folder_name_to_backup``` what folder within the PLEX data structure to backup
+
+```plex_Preferences_loction``` where is the PLEX preference file? this is needed to terminate any active streams
+
+
+### Configuration of Task Scheduler
+
+1. Control Panel -> Task Scheduler
+2. Click ```Create -> Scheduled Task -> User-defined script```
+3. Under "General Settings" name the script "PLEX Auto-backup" and choose the "root" user and ensure the task is enabled
+4. Click the "Schedule" tab at the top of the window. in this example we will set it to run monthly and will run at 11:00 PM
+5. Select "Run on the following date" and choose the day of the current or next month you wish for the script to run. also ensure "Repeat Monthly" is selected
+6. Under Time, set "First run time" to "23" and "00"
+7. under "Frequency" select "every day"
+8. under last run time select "23:00"
+9. go to the "Task Settings" tab
+10. Ensure "Send run details by email" is checked and enter the email address to send the logs to.
+11. Under "Run command" enter ```bash /volume1/[shared_foler_name]/logging/plex_backup.sh``` NOTE: ensure the ```/volume1/[shared_foler_name]/logging/``` is where the script is located
+12. click "ok" in the bottom right
+13. IF desired, find the newly created task in your list, right click and select "run". when a confirmation window pops up, choose "yes". The script will run. WARNING this will shutdown any active streams and turn off PLEX while the backup process is happening.
+
+
+(back to top)
+
+
+
+
+## Contributing
+
+(back to top)
+
+
+
+
+## License
+
+This is free to use code, use as you wish
+
+(back to top)
+
+
+
+
+## Contact
+
+Your Name - Brian Wallace - wallacebrf@hotmail.com
+
+Project Link: [https://github.com/wallacebrf/plex_backup)
+
+(back to top)
+
+
+
+
+## Acknowledgments
-"plex_backup_dir" is where the .tar backup file will be copied to for starage
-"PMS_IP" is the IP address of used to access PLEX
-"plex_installed_volume" what volume on the synology NAS is plex installed on
-"log_file_location" where on the system would you like the log file stored
-to install, copy the file to a desired location on the system and use Task Scheduler under the control panel to set the script to run when desired. ensure the script runs as root.
-if an email of the results is desired, use synology task scheduler and choose the option to send an email notiifcation
+(back to top)