Request for Plex package on Synology

Yeah i’ll do that as well then… I’m just doing it now, did you adjust the typos in both sections you posted examples? i.e. The months as well?

Cheers Chuck :slight_smile:

yes, I did.

To confirm, here is final form

#!/bin/sh

# Stop Plex while we make the backup
"/var/packages/Plex Media Server/scripts/start-stop-status" stop

# What day of the week is it
Today="$(date '+%a')"

# Make a full backup of all the metadata, configuration, and databases
cd /volume1/Plex
tar cfz "/volume1/Plex-Backups/${Today}_Snapshot.tar" ./Library

# Restart PMS
"/var/packages/Plex Media Server/scripts/start-stop-status" start

# Set the permissions on the backup file so they can be accessed by the admin user
chown admin.users  "/volume1/Plex-Backups/${Today}_Snapshot.tar"

Cheers! One last questions… should I run the task as the user plex, root or my own account? I presume whichever user will also need access to the backup shared directory?

I have written this to run as if user root

As root, it preserves all information. Also, as root, it is free of any and all permission restrictions. It is the “Super User” and can do anything it wishes.

Okay i’m getting an error when running the script:

Dear user,

Task Scheduler has completed a scheduled task.

Task: Plex Backup

Start time: Tue, 25 Feb 2020 00:19:20 GMT Stop time: Tue, 25 Feb 2020 00:19:31 GMT Current status: 0 (Normal) Standard output/error:

Stopping Plex …

tar: ./Library: Cannot stat: No such file or directory

tar: Exiting with failure status due to previous errors Starting Plex …

Any ideas?

Inject :man_facepalming: here! DOOH

Before the tar statement, add:

cd /volume1/Plex

If your Plex share is on /volume2 then use that.
I will adjust the final above.

Confirmation:

admin@moesern:~$ cd /volume1/Plex
admin@moesern:/volume1/Plex$ ls -la
total 11578824
drwxrwxrwx+  5 root  root         4096 Feb 19 15:02 .
drwxr-xr-x  37 root  root         4096 Jan 21 19:21 ..
-rwxrwxrwx+  1 plex  users           0 Feb 14 22:00 Bitte legen Sie hier keine Mediendateien ab.
drwxrwxrwx+  3 plex  users        4096 Dec 31 13:27 @eaDir
drwxrwxrwx+  3 plex  users        4096 Jun 23  2019 Library
-rwxrwxrwx+  1 chuck users 11856686999 Feb 19 13:34 Library.zip
-rwxrwxrwx+  1 plex  users           0 Feb 14 22:00 Please do not place any media files here.
-rwxrwxrwx+  1 plex  users           0 Feb 14 22:00 Por favor, no coloque ningún archivo multimedia aquí.
drwxrwxrwx+ 11 plex  users        4096 Feb 17 14:33 tmp_transcoding
-rwxrwxrwx+  1 plex  users           0 Feb 14 22:00 Veuillez ne placer aucun fichier multimédia ici.
-rwxrwxrwx+  1 plex  users           0 Feb 14 22:00 ここにメディアファイルを置かないでください。
-rwxrwxrwx+  1 plex  users           0 Feb 14 22:00 请不要在此处放置任何媒体文件。
admin@moesern:/volume1/Plex$ 

Okay it might get tricky now, Plex itself is installed on Volume1, but I have my Shares on Volume1,2,3,4

Does that affect anything?

No. We only backup the metadata directory which is on /volume1

That’s all we are concerned with.

You backup your media independently.

Okay that’s worked, it’s 15GB though so I will most likely stick with 1 weeks worth of backups.

I can also access that new share should I need to.

Thank you very much for all your help Chuck, it’s appreciated!

I’m glad.
Now you have your access (which is appropriate and your right)
and I have the peace of mind to know the Plex share is also safe from accidents (except for Plex engineers making dumb typos LOL)

1 Like

:slight_smile: :fist_right: :fist_left:

Hi Chuck,

I just wanted to report back after a little white to let you know and others who may come across this in the future that the script is working perfectly and rotates every week.

Thanks very much for all your help!

I’m glad I could help craft a solution which works for you

Hi Chuck,

I’ve had a problem where my Docker package failed randomly and all my dockers were turned off. Although Plex was installed through the official package, Synology support have recommended I reset the system which they say will retain my content but the filesystem and packages will all be removed.

I’m about to do that, do how do I now restore from these settings we backed up please?

Thanks.

You have left a few ambiguous points in your question.

Before taking any action, these need be resolved .

  • Which type of reset?

a. If you reset the Operating System, your content is preserved
b. If you reset the entire NAS to factory default, nothing is retained. The unit will be as if you were powering up for the very first time.

Clarity here is required. What was their reply?

Hi chuck,

They recommended pressing the reset button at the back for 4 seconds until I heard a beep, then release and re-press for 4 seconds until I hear 3 beeps.

I’ve done that now and am setting up the O/S from scratch. All my settings and programs have gone but my content (Movies, folders etc…) are still there.

That is a DSM re-installation.

I was challenging you only because If it had beeped 4 times it would have erased all your storage.

As it stands now, only DSM was erased. (The disks are partitioned. This operation erases and reinstalls the OS)

Okay so are you saying if I just re-install the Plex package all my Plex settings and movies will still be there? If not how do I restore the settings/database etc…please?

If you install the base Plex package,

As long as the Plex share still exists,

The installer will find your existing metadata and media.

It will continue as if no interruption ever occurred.

In a worst-case scenario, you might need give user Plex permission to read your media shares again (Control Panel - Shared Folders )

Okay sounds good, i’ll just finish up configuring everything then install all my packages and give it a go.

Thanks as always Chuck :slight_smile: