Echo Snippet

Kick 'n'Dirty



CSS 8 DNS 1 SQL 1 ajax 1 apache 3 bash 11 convert 3 crontab 2 css 1 error 1 fail2ban 2 gogs 1 grav 1 htaccess 3 html 13 ip 8 iptables 2 js 6 mail 2 nano 2 netatmo 1 php 42 php4 1 php5 2 php7 1 plex 1 powershell 1 regex 1 rss 3 secu 2 shell 26 ssl 2 stylus 3 tls 1 windows 1 youtube 2

.

update-plex.sh

update-plex.sh

#!/bin/bash

#####
#
# This Script will update Plex Media Server to the latest version for Ubuntu
#
# To automatically check & update plex, run "crontab -e" and add the following lines
#
# # Check for Plex Media Server Updates every day @6:00 am
# 0 6 * * * /root/update-plexmediaserver.sh
#
#  2018 - Original by Matthieu Guerry
#       - Customised by erreur32
###

# Check Current installed version and exit if latest is already installed
service=plex
VersionInstalled=$(dpkg -s plexmediaserver | grep -Po '(?<=Version\: )(\S+)')
if [[ -z $VersionInstalled ]]; then echo " Plex is not installed - exit "; exit; fi
VersionAvailable=$(curl -s "https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=16&distro=ubuntu" | grep -Po '(?<=(\" version=\"))(\S+)(?=(\"))')
echo -e " Checking Plex version ... "
echo -e " Version installed = $VersionInstalled"
echo -e " Version Available = $VersionAvailable"

if [ $VersionAvailable = $VersionInstalled ]; then echo "Plex Media Server is already up-to-date (version $VersionInstalled) ... Bye! "; exit; fi

echo -e " Download new Version  $VersionAvailable"
# Download latest installation package to /tmp folder
curl -s "https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=16&distro=ubuntu" | grep -Po '(?<=url=\")(\S+)(?=\")' | xargs wget -P /tmp/

if [[ -z $(ps -ef |grep ${service}) ]]
then
   print "Hum service down !?! , anyway Service will updating\n"
else
   print "Plex is running, service will stop before Update...\n"
fi
# Stop Plex Service
sudo service plexmediaserver stop
# Install latest version
sudo dpkg -i /tmp/$(curl -s "https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=16&distro=ubuntu" | grep -Po '(?<=fileName=\")(\S+)(?=\")')


ps -ef | grep plex | grep -v grep
[ $?  -eq "0" ] && echo "Plex is running back :)" || echo "Plex is not running ... ;("

# Start Plex Service
echo -e " restart service Plex"
sudo service plexmediaserver start

# Remove installation package from /tmp folder
rm /tmp/plexmediaserver_*

plex shell

<iframe width="100%" height="1118" src="https://snippet.echosystem.fr?embed=5bdf3936ae288" type="text/html"></iframe>

Texte seul - Permalink - Snippet public posté le 02/11/2021

Flux RSS de cette page


Echo Snippet 1.84 par Bronco - Page générée en 0.003 s