December 17, 201411 yr I looked all over for a script that does this and couldn't find it. If this is a double post, my apologies as I can't imagine I'm the first one to raise this topic. I wanted to share my script that checks if Plex is taking connections on it's default port and attempts to cycle it if not. You would have to place it in the root of your flash drive otherwise known as /boot. This would be run as an hourly cron job or w/e you prefer. To have this change persist across reboots, you must add this to your go file. crontab -l > /tmp/cron; echo '#Run Hourly Plex Connection Check' >> /tmp/cron; echo '30 * * * * /boot/PlexCheck' >>/tmp/cron; crontab /tmp/cron; rm /tmp/cron The script echo's the results to the console which I prefer however you could get rid of it by adding &>/dev/null to the end of the cron job. The script could also be easily edited to have the echo's append to a file as a log that can be checked. I prefer the console. So far my go file and script have been tested and working as expected. In my experience, plex may indeed be running, however it will stop taking connections from time to time. This method will catch both conditions where plex is not running or plex is running but not responding to connections properly and attempt to resolve it. Script attached. You will need to drop the .txt extension when it is placed on your flash drive. PlexCheck.txt
December 17, 201411 yr Author Also here's a version that outputs to a log file you can check to make sure it's running and what the results of the run are. The log is /var/PlexCheckLog This is the volital file system that exists in memory and should clear each reboot. I doubt anyone's uptime would be long enough for the log size to ever be a problem so i decided not to add any log rotation or clean up apart of the script. I didn't make seance to put the log on the flash or cache disk. You would be able to view the log when logged into the sever as shown below. root@Tower:/var# cat ./PlexCheckLog Wed Dec 17 13:52:09 CST 2014 Plex appears to be accepting connections! Wed Dec 17 14:30:01 CST 2014 Plex appears to be accepting connections! Wed Dec 17 15:30:01 CST 2014 Plex appears to be accepting connections! root@Tower:/var# tail -10 ./PlexCheckLog Wed Dec 17 13:52:09 CST 2014 Plex appears to be accepting connections! Wed Dec 17 14:30:01 CST 2014 Plex appears to be accepting connections! Wed Dec 17 15:30:01 CST 2014 Plex appears to be accepting connections! PlexCheckv2.txt
December 18, 201411 yr I would put a loop in it so that it would try say three times, waiting 60 seconds between tries, before it stops/starts plex. This way just in case it is busy and misses the first attempt or even the second.
December 18, 201411 yr Author Yeah I could try that. It's humanly possible Plex is doing some heavy streaming or the system is loaded and fail an attempt here and there. That's certainly true with some of my server up SSH port checks to find downed systems at work that use almost the same logic. I'll update it later.
December 18, 201411 yr Author Here is my script that adds on 3 retry attempts before restarting plex. I've tested it and it appears to be working. I tried to load the box to test my loaded system condition but that's something a little hard to simulate. Far as I can tell, it should work should that condition arise. Additional logging was sent to /var/PlexCheckLog. You will either have to rename the script to match the entry in the go file or edit the go file to reflect the script name "PlexCheckv3". Logging will now look something like this., That first line is another cron job that cycles Plex at Night anyway. This is a highly paranoid check, not really necessary. Thu Dec 18 04:00:20 CST 2014 Plex was restarted for nightly reboot and appears to be taking connections Thu Dec 18 04:30:01 CST 2014 Plex appears to be accepting connections! Thu Dec 18 05:30:02 CST 2014 Plex appears to be accepting connections! Thu Dec 18 06:30:01 CST 2014 Plex appears to be accepting connections! Thu Dec 18 07:30:01 CST 2014 Plex appears to be accepting connections! Thu Dec 18 08:30:42 CST 2014 Plex appears to be accepting connections! Thu Dec 18 09:30:01 CST 2014 Plex appears to be accepting connections! Thu Dec 18 10:08:15 CST 2014 Plex is not accepting connections, retrying Thu Dec 18 10:08:25 CST 2014 Plex is not accepting connections, retrying Thu Dec 18 10:08:35 CST 2014 Plex is not accepting connections, retrying Thu Dec 18 10:09:57 CST 2014 Plex was restarted and appears to now be accepting connections Thu Dec 18 10:15:27 CST 2014 Plex appears to be accepting connections! Thu Dec 18 10:15:49 CST 2014 Plex appears to be accepting connections! Thu Dec 18 10:16:30 CST 2014 Plex appears to be accepting connections! Thu Dec 18 10:17:48 CST 2014 Plex is not accepting connections, retrying Thu Dec 18 10:12:17 CST 2014 Plex is not accepting connections, retrying Thu Dec 18 10:12:27 CST 2014 Plex is not accepting connections, retrying Thu Dec 18 10:13:02 CST 2014 Plex was restarted and appears to now be accepting connections Thu Dec 18 10:21:58 CST 2014 Plex is not accepting connections, retrying Thu Dec 18 10:22:08 CST 2014 Plex is not accepting connections, retrying Thu Dec 18 10:22:37 CST 2014 Plex was restarted and appears to now be accepting connections Thu Dec 18 10:30:01 CST 2014 Plex appears to be accepting connections! PlexCheckv3.txt
December 29, 201411 yr Have you been having problems with Plex disappearing? I too have had an issue since upgrading to v6.
January 2, 201511 yr Author As far as Unraid beta version? I am still running 5.05 myself. v6 was unstable for me last time I tested which was sometime ago.
February 20, 201610 yr Author Btw if anyone knows how to bounce a docker as easily as a plex service, I can update this to support version 6 however the issue I created this script for has never surfaced in the mature versions of Unraidv6 yet.
Archived
This topic is now archived and is closed to further replies.