Unraid logo

Alternative Method to Spin Up Unraid Drives Using Plex Logs

In a previous post, I discussed a method to spin up Unraid drives using Home Assistant. However, there’s an alternative method that doesn’t involve Home Assistant at all. Both methods, the previously discussed one and the one I’m about to describe, do not work 100% of the time for various reasons. Therefore, I recommend using both if possible to maximize your chances of success.

This alternative method was brilliantly suggested by a user on the Unraid forums, @matthawkp, and all credit goes to them for this idea. You can check out the original discussion here.

To achieve this:
  1. If you haven’t done this already, find and install the User Scripts plugin from the Apps section in Unraid.
  2. Open User Scripts from the Plugins section in Unraid, and click on Add New Script.
  3. Type in the following code:
#!/bin/bash
tail -f /mnt/user/appdata/Plex-Media-Server/Library/Application\ Support/Plex\ Media\ Server/Logs/Plex\ Media\ Server.log | awk '/Signed-in Token/' > /mnt/user/HTPC/wakemyarray.log
  1. Make sure you change the paths for the Plex logs (mine are under /mnt/user/appdata/Plex-Media-Server) and for the array you want to wake up (mine is in /mnt/user/HTPC).
  2. Click Save, choose At Startup of Array in the dropdown next to this newly added script, and click on Run in Background. This will start the script, which will run indefinitely.

This script essentially “listens” to the Plex logs. Whenever it detects a new login (which appears in the logs as “Signed-in Token”), it writes or updates the file wakemyarray.log on your media array, causing it to wake up.

The shortcoming? You’re not always logging in. Sometimes Plex is already open, and you continue using it after a while, which means the drives might have spun down in the meantime. As mentioned earlier, this will not work 100% of the time, but it’s so easy to set up that it’s worth doing even if it doesn’t always work. I believe this approach is promising, and I’ll keep exploring this direction. If you find a better solution, please let me know.


Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply