{"id":17674556,"url":"https://github.com/007revad/synology_plex_backup","last_synced_at":"2025-09-24T02:20:07.827Z","repository":{"id":65683525,"uuid":"568614414","full_name":"007revad/Synology_Plex_Backup","owner":"007revad","description":"A script to backup Plex to a tgz file. For DSM 7 and DSM 6.","archived":false,"fork":false,"pushed_at":"2025-03-22T20:02:10.000Z","size":140,"stargazers_count":33,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-15T22:34:52.498Z","etag":null,"topics":["backup","dsm","plex","plex-media-server","plex-server","plexmediaserver","synology","synology-nas","synology-package"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/007revad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"007revad","custom":["https://www.paypal.me/007revad"]}},"created_at":"2022-11-21T03:00:14.000Z","updated_at":"2025-03-23T07:24:26.000Z","dependencies_parsed_at":"2023-12-10T09:28:40.894Z","dependency_job_id":"6388ef19-7f8b-4453-af75-3712b83a50f0","html_url":"https://github.com/007revad/Synology_Plex_Backup","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/007revad%2FSynology_Plex_Backup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/007revad%2FSynology_Plex_Backup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/007revad%2FSynology_Plex_Backup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/007revad%2FSynology_Plex_Backup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/007revad","download_url":"https://codeload.github.com/007revad/Synology_Plex_Backup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249705365,"owners_count":21313349,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup","dsm","plex","plex-media-server","plex-server","plexmediaserver","synology","synology-nas","synology-package"],"created_at":"2024-10-24T07:07:35.569Z","updated_at":"2025-09-24T02:20:02.802Z","avatar_url":"https://github.com/007revad.png","language":"Shell","funding_links":["https://github.com/sponsors/007revad","https://www.paypal.me/007revad","https://www.paypal.com/paypalme/007revad"],"categories":[],"sub_categories":[],"readme":"# Synology Plex Backup\n\n\u003ca href=\"https://github.com/007revad/Synology_Plex_Backup/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/release/007revad/Synology_Plex_Backup.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://hits.seeyoufarm.com\"\u003e\u003cimg src=\"https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2F007revad%2FSynology_Plex_Backup\u0026count_bg=%2379C83D\u0026title_bg=%23555555\u0026icon=\u0026icon_color=%23E7E7E7\u0026title=views\u0026edge_flat=false\"/\u003e\u003c/a\u003e\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/paypalme/007revad)\n[![](https://img.shields.io/static/v1?label=Sponsor\u0026message=%E2%9D%A4\u0026logo=GitHub\u0026color=%23fe8e86)](https://github.com/sponsors/007revad)\n[![committers.top badge](https://user-badge.committers.top/australia/007revad.svg)](https://user-badge.committers.top/australia/007revad)\n\n### Description\n\nThis is a bash script to backup a Synology's Plex Media Server settings and database, and log the results.\n\n-  Works for Plex installed from Package Center and in Docker.\n-  The script works in DSM 7 and DSM 6.\n\n#### What the script does:\n\n-   Gets your Synology's hostname and model (for use in the backup filename and log name).\n-   Checks that the script is running as root.\n-   Checks it is running on a Synology.\n-   Gets Plex Media Server's version (for the backup filename and log).\n-   Gets the volume and share name where Plex Media Server's database is located.\n-   Checks that your specified backup location exists.\n-   Stops Plex Media Server, then checks Plex actually stopped.\n-   Backs up Plex Media Server to a tgz file (**excluding the folders listed in plex_backup_exclude.txt**).\n-   Starts Plex Media Server.\n-   Optionally adds an entry to the Synology's system log stating if the backup succeded or failed.\n-   Optionally sends a notification to DSM if Plex Backup completed, or had errors (**only works in DSM 6 for now**).\n\n#### It also saves a log in the same location as the backup file, including:\n\n-   Logging the start and end time plus how long the backup took.\n-   Logging every file that was backed up (can be disabled).\n-   Logging any errors to a separate error log file to make it easy for you to see if there were errors.\n\nThe Synology's hostname, date, and Plex Media Server version are included in the backup's filename in case you need to roll Plex back to an older version or you save backups from more than one Plex Server.\n\n**Example of the backup's auto-generated filenames:** \n-   DISKSTATION_20221025_Plex_1.29.0.6244_Backup.tgz\n-   DISKSTATION_20221025_Plex_1.29.0.6244_Backup.log\n-   DISKSTATION_20221025_Plex_1.29.0.6244_Backup_ERROR.log (**only if there was an error**)\n\nIf you run multiple backups on the same day the time will be included in the filename.\n\n**Example of the backup's auto-generated filenames when run more than once on the same day:** \n-   DISKSTATION_20221025_1920_Plex_1.29.0.6244_Backup.tgz\n-   DISKSTATION_20221025_1920_Plex_1.29.0.6244_Backup.log\n\n### Download the script\n\n1. Download the latest version _Source code (zip)_ from https://github.com/007revad/Synology_Plex_Backup/releases\n2. Save the download zip file to a folder on the Synology.\n3. Unzip the zip file.\n\n### Settings\n\nYou need to set **backupDirectory=** near the top of the script (below the header). Set it to the location where you want the backup saved to. \n\n**For example:**\n\n```YAML\nbackupDirectory=\"/volume1/Backups/Plex_Backups\"\n```\n\n**For Docker there are few more settings required:**\n\n```YAML\n# Backup docker Plex instead of package center Plex\nDocker=\"yes\"\n# Path to Plex container's 'Application Support' folder\nDocker_plex_path=\"/volume1/docker/plex/Library/Application Support\"\n# Plex container name\nDocker_plex_name=\"plexinc-pms-docker-1\"\n```\n\n**There are also a few optional settings:**\n\nThe script gets the brand, model and hostname from the NAS to use logs and backup name.\nSet Name= to \"brand\", \"model\", \"hostname\" or some nickname. If Name= is blank the Synology's hostname will be used.\n\n```YAML\nName=\"brand\"\n```\n\nLog all files backed up. If enabled all files added to the tgz archive will be logged.\nSet LogAll= to \"yes\" or \"no\". Blank is the same as no.\n\n```YAML\nLogAll=\"no\"\n```\n\nAdd Plex backup success or Plex backup failed entry to DSM system log.\nSet SysLog= to \"yes\" or \"no\". Blank is the same as no.\n\n```YAML\nSysLog=\"yes\"\n```\n\nAdd success or failed entry to DSM notifications.\nSet Notify= to \"yes\" or \"no\". Blank is the same as no.\n\n```YAML\nNotify=\"yes\"\n```\n\n### Requirements\n\nMake sure that plex_backup_exclude.txt is in the same folder as backup_synology_plex_to_tar.sh\n\n**Note:** Due to some of the commands used **this script needs to be run as root, or be scheduled to run as root**.\n\n\n### Testing the script\n\nIf you run the script with the **test** argument it will only backup Plex's Logs folder.\n\n```YAML\n\"/volume1/scripts/Backup_Plex_on_Synology.sh\" test\n```\n\nIf you run the script with the **error** argument it will only backup Plex's Logs folder and cause an error so you can test the error logging.\n\n```YAML\n\"/volume1/scripts/Backup_Plex_on_Synology.sh\" error\n```\n\n### Restoring a backup\n\nTo restore Plex from a backup run the following in a shell:\n\n**Note:** Replace \"/path/file.tgz\" with your backup file's path and filename. Replace the 1 in volume1 with your volume number.\n\nFor DSM 7\n```YAML\ntar -zxvpf /path/file.tgz -C \"/volume1/PlexMediaServer/AppData/\"\n```\n\nFor DSM 6\n```YAML\ntar -zxvpf /path/file.tgz -C \"/volume1/Plex/Library/Application Support/\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F007revad%2Fsynology_plex_backup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F007revad%2Fsynology_plex_backup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F007revad%2Fsynology_plex_backup/lists"}