Skip to content

Instantly share code, notes, and snippets.

@fwenzel
Created April 26, 2012 03:17
Show Gist options
  • Save fwenzel/2495425 to your computer and use it in GitHub Desktop.
Save fwenzel/2495425 to your computer and use it in GitHub Desktop.
Simple watchdog script to restart plex media server if it becomes unresponsive.
#!/bin/bash
# If plex is not running, don't do anything.
plex_running=`ps ax | grep "\./Plex Media Server" | awk '{ print $1 }' | wc -l`
if [ "$plex_running" -eq 1 ]; then
exit 0
fi
# Test Plex web interface. If it's dead, this'll time out in a few seconds.
curl -I -m 8 "http://localhost:32400/library/sections" > /dev/null 2>&1
if [ "$?" -ne "0" ]; then
/usr/sbin/service plexmediaserver restart
fi
@hspantera
Copy link

Its possíble to make the same script file but in batch to use on Windows? Thanks..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment