Skip to content

What is the script to restart Plex media server?

  • by
  • 2 min read

If you’re willing to, Plex allows you to set up a home media server. This means you can have your movies, TV shows and music running off your server. That said, Plex requires some technical know-how and can sometimes run into random errors or problems.

In most cases, restarting the media server will fix your issues. However, you need to be near your server to do that. In this article, we’re talking about how you can use scripts to restart your Plex media server. 

Also read: Roblox speed script: All you need to know


Controlling Plex with scripts

Instead of dabbling in Plex configuration settings, using scripts to control the media server’s behaviour is an easy and automated way to ensure your server stays up and running. 

You can do this in multiple ways, depending on whether you’re running Windows or Linux. On Windows, a small batch file to restart your Plex server would look something like this

TASKKILL /f /im "Plex Media Server.exe"
TASKKILL /f /im "PlexScriptHost.exe"
"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe"

As you can see, all this does is kill running Plex processes and runs the service again. You can further introduce error checks into this so the script can catch any exceptions from Plex and restart the server if required. 

Local Plex servers often crash due to errors.

A better way of doing the same would be using the Plex Checker script from Gavin Fuller. This is a Python script and is compatible with both Windows and Linux. However, it should also work on macOS and BSD, but it hasn’t been tested. 

In its most basic form, the script attempts to connect to a Plex server and restarts the executable file if no response is received. This makes sure your script only runs when Plex is down. The script can also be modified to do additional tasks when it detects Plex (or any other program of your choice) has gone offline or stopped responding. 

Also read: How to fix Error: Cannot squash without a previous commit? 

>