Spin up data disk when user login into plex

So in the end, there is a log file in plex “com.plexapp.system.log”,
every time a login is successful, the log entery, “Handling request GET /system/agents/media” apears.

With this bash script I check for this entery.

#!/bin/bash
tail -F "/usr/local/plexdata-plexpass/Plex Media Server/Logs/PMS Plugin Logs/com.plexapp.system.log" | \
while read line ; do
        echo "$line" | grep "Handling request GET /system/agents/media"
        if [ $? = 0 ]
        then
        touch /mnt/tank/test.txt
        rm /mnt/tank/test.txt
        sleep 1
        fi
done

With the “touch” command, I get sure that the disk needs to spin up.

I start this scribt as a deamon on start up of the server.

Works well for me…