Created
May 12, 2018 19:17
-
-
Save mitchellrj/266a2437b78a2d0f9aa7f07f48e88b05 to your computer and use it in GitHub Desktop.
CentOS / Red Hat auto updater script for Plex media server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
plex_token="YOUR TOKEN HERE" | |
plex_rpm_url="https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=redhat&X-Plex-Token=$plex_token" | |
current_version="$(rpm -q --queryformat '%{VERSION}\n' plexmediaserver)" | |
latest_version="$(curl -I $plex_rpm_url 2>/dev/null | egrep '^Location:' | cut -d'/' -f 5 | cut -d'-' -f1)" | |
if [ "$current_version" != "$latest_version" ]; then | |
rpm -Uvh $plex_rpm_url >/dev/null 2>&1 | |
success="$?" | |
service plexmediaserver start | |
fi | |
exit $success |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment