Hi there, it’s my first post so please don’t roast me.
I searched the forum but found no post so far.
I’d like to execute a command after a successful user login in order to spin up my data disk.
Is there a plex trigger to start a script after a successful user login?
Usually my data disk are stopped (plex server is on ssd no sleep mode, data disk is on hdd sleep mode activated).
The data disk spin up when the first user starts a movie (first access of data disk).
Unfortunately, the spin up process takes around 20 seconds (disk are spinning up sequentially) and results in an error for the plex user.
Probably a data transmission timeout between plex server and plex player.
When data disk are spinning this error never occurs.
Is there a possibility to trigger an post user login task in order to pre spin up the data disk before a user start’s a movie.?
I might have found a way. There is a plex log file, and in there I could search for entries of user logins. When I would find a new entry I cloud start the script that would access my spinning disks.
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.
HI,
i have given ul on spun down disk a long time ago… it is just not possible for extended period of time. and if a set 1h spin down time, its just bad for the disk. spun down fkr 2 hours, gets cold, gets a random system query, spins up from low temo, spins for an hour, gets normal temp, spins down for a few hours, gets cold again. i think thats a terrible wear and tear on a drive.
there is a plug in, which lists what files are being accessed, and logs it. i will look it up when i het home. it shows most drive activity, but there were a fe2, which werent even listed there. thats when i finally gave up. btw, if you have a subtitle plex addon, it could cause extra scans as well