Plex Media Server is killed due to memory spikes – how can I auto-relaunch it?
Applicable Products
Plex Media Server
Scenario
The Plex process is sometimes killed in the background due to a temporary memory spike. You would only discover Plex is down when trying to stream and would need to restart it manually.
Solution
With this solution, Plex Media Server will be automatically relaunched within 30 seconds, minimizing downtime and manual restarts.
Steps:
Stop Plex Media Server
Connect to your NAS command prompt via SSH.
Find and change to the directory of the Plex Media Server QPKG.
[~] # QPKG_DIR=$(getcfg -f "/etc/config/qpkg.conf" PlexMediaServer Install_path) [~] # cd $QPKG_DIR
Edit the startup script
plex.sh
using vi editor.
4.1 Locate the following line:./Plex\ Media\ Server &
4.2 Relace it with the following line:/sbin/daemon_mgr "Plex Media Serv" "start" "${QPKG_DIR}/Plex\ Media\ Server >/dev/null &"
⚠️ Make sure to keep the space after the backslash (\ ) in Plex\ Media\ Server. The backslash escapes the space character in the folder name.
- Save changes into the file and exit
- Start Plex Media Server.