Jump to content
veezer

Docker to auto sleep/wakeup Plex server: WakerUp

2 posts in this topic Last Reply

Recommended Posts

Hi all,

Just thought I'd share a few scripts I wrote and packaged up as a docker for auto sleeping/waking up a Plex server.  This docker, called WakerUp works in the following scenario:

  • You have a stand-alone Plex server running on Linux (preferably Ubuntu).
  • You have a firewall/router capable of logging firewall accesses to a file or syslog server.
  • Your Plex server can be remotely woken up via a Wake-On-Lan magic packet.
  • You can ssh into your Plex server.

 

If so, then WakerUp will run on your Unraid system as a docker container, and it will remotely monitor your Plex server for activity via the Plex API.  If it detects inactivity, it will sleep the Plex server via ssh after a suitable interval.  Once the server is asleep, WakerUp will continue monitoring the log, looking for accesses in the firewall log for things like port 32400 (the Plex network port), although the exact search string is configurable, and will send the sleeping Plex a WOL packet to wake it up, and then repeat the whole sleep/wakeup process indefinitely.

 

Since my Plex server also serves files over NFS, I needed a way to trigger scans on my library for new items every now and then (since the auto-detect of file system changes doesn't work over NFS), so WakerUp will also trigger library scans at regular, user-configurable intervals when the server is awake.

 

Everything is open-source: You can find the documentation and source here:  https://github.com/virantha/wakerup

 

To install, you just add https://github.com/virantha/docker-containers into your Docker templates repository list:

img_unraid_template.png

 

And then add a new Docker container called 'wakerup':

 

img_unraid_settings.png

 

The settings are explained in the README in the source repository, but should be fairly straightforward.  You shouldn't have to do any configuration on your Plex server, as WakerUp will take care of setting up ssh keys, and installing pm-utils on the server.  Once installed, check your docker log to make sure it looks something like the following:

 

img_unraid_log.png

 

Let me know if anyone finds this useful or if you have any questions!

Share this post


Link to post

This sounds great. Might give it a try when tuning my rig for energy efficiency.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.