I posted a while back how to test if Plex was running on your Asustor NAS, and how to restart it.
This stopped working when I started using Plex Home features. While working on a different problem Mark Walker showed me the correct curl part of the script I was using to test with. This works on Plex Home.
The first part is making the actual testing script:
With WinSCP, make a new file and call it S56CkPlex.sh (I put this script in a folder for misc stuff. plexWatch, Maraschino, etc. the path I use is: /volume1/misc
This file should contain the following lines:
echo "Checking Plex..." >> /var/log/checkPlex.log date >> /var/log/checkPlex.log curl -I -m 8 "http://localhost:32400/web/index.html"; if [ "$?" -ne "0" ] then echo "Plex froze. Restarting.." >> /var/log/checkPlex.log date >> /var/log/checkPlex.log echo "Plex froze. Restarting.." /usr/local/AppCentral/plexmediaserver/CONTROL/start-stop.sh restart fi
The next part involved modifying the existing start-stop.sh. You need to insert the bolded parts in this file:
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
restart)
do_stop
sleep 15
do_start
;;
esac
exit 0
The last part is to put in a cronjob. Go to this folder/file in WinSCP:
/var/spool/cron/crontabs/root
Put this line into the file:
*/20 * * * * /volume1/misc/S56CkPlex.sh
Make sure you save this. Then, open Terminal within WinSCP and execute the following:
/etc/init.d/S41crond restart
This restarts the cron daemon and makes sure you job is running every 20 minutes. Now, if you look at the log files created by this script you can check it's running. After you get it going you can comment out the 1st 2 lines so it doesn't keep filling the logs with checking messages. After this it just puts in restart messages.
Thanks to Mark Walker for providing me with an updated curl line for testing Plex is running. the line I haad worked, but errored out....