Son aktivite 1 month ago

Erreur32's Avatar Erreur32 bu gisti düzenledi 6 months ago. Düzenlemeye git

Değişiklik yok

Erreur32 bu gisti düzenledi 7 years ago. Düzenlemeye git

1 file changed, 39 insertions, 27 deletions

Updater-plex.sh

@@ -2,51 +2,63 @@
2 2
3 3 #####
4 4 #
5 - # This Script will update Plex Media Server to the latest version for Debian/Ubuntu
5 + # This Script will update Plex Media Server to the latest version for Ubuntu
6 6 #
7 7 # To automatically check & update plex, run "crontab -e" and add the following lines
8 8 #
9 9 # # Check for Plex Media Server Updates every day @6:00 am
10 - # 0 6 * * * /root/update-plexmediaserver.sh
10 + # 0 6 * * * /path/you/want/update-plexmediaserver.sh
11 11 #
12 - # 2018 - Original by Matthieu Guerry
13 - # - Customised by erreur32
12 + # 2018 - Script by erreur32
13 + # - inspired by Matthieu Guerry
14 14 ###
15 15
16 + VERT="\\033[0;32m"
17 + VERTG=
18 + NORMAL="\\033[0;39m"
19 + ROUGE="\\033[0;31m"
20 + ROSE="\\033[1;35m"
21 + BLEU="\\033[0;34m"
22 + BLANC="\\033[0;02m"
23 + BLANCLAIR="\\033[0;08m"
24 + JAUNE="\\033[0;33m"
25 + CYAN="\\033[0;36m"
26 + ORANGE=$(tput setaf 208)
27 + GRIS=$(tput setaf 8)
28 + BOLD=$(tput bold)
29 + Underline=$(tput sgr 0 1)
30 + NOC=$(tput sgr0)
31 + NC=$(tput sgr0)
32 +
16 33 # Check Current installed version and exit if latest is already installed
17 34 service=plex
18 35 VersionInstalled=$(dpkg -s plexmediaserver | grep -Po '(?<=Version\: )(\S+)')
36 +
19 37 if [[ -z $VersionInstalled ]]; then echo " Plex is not installed - exit "; exit; fi
20 38
21 39 VersionAvailable=$(curl -s "https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=16&distro=ubuntu" | grep -Po '(?<=(\" version=\"))(\S+)(?=(\"))')
22 - echo -e " Checking $service version ... "
23 - echo -e " Version installed = $VersionInstalled"
24 - echo -e " Version Available = $VersionAvailable"
25 40
26 - if [ $VersionAvailable = $VersionInstalled ]; then echo "Plex Media Server is already up-to-date (version $VersionInstalled) ... Bye! "; exit; fi
41 + echo -e "\n$VERT Checking Plex version ...\n"
42 + echo -e "$JAUNE Version installed = $VersionInstalled"
43 + echo -e "$JAUNE Version Available = $ORANGE$VersionAvailable"
44 + #UrlNewVersion=$(curl -sS "https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=16&distro=ubuntu" | grep -Po '(?<=url=\")(\S+)(?=\")')
27 45
28 - echo -e " Download new Version $VersionAvailable"
46 + if [ $VersionAvailable = $VersionInstalled ]; then echo -e "\n Plex Media Server is already up-to-date $NC ;) Bye! "; exit; fi
47 + echo -e "\n$VERT Downloading new Version --> $ORANGE$VersionAvailable \n $GRIS"
29 48 # Download latest installation package to /tmp folder
30 - 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/
31 -
32 - if [[ -z $(ps -ef |grep ${service}) ]]
33 - then
34 - print "Hum service down !?! , anyway Service will updating\n"
35 - else
36 - print "Plex is running, service will stop before Update...\n"
37 - fi
38 - # Stop Plex Service
39 - sudo service plexmediaserver stop
49 + 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/ 2> /dev/null
50 + echo -e "$ORANGE Installation in progress ...$GRIS\n"
51 + # Stop Plex Service before updating
52 + sudo service plexmediaserver stop 2> /dev/null
40 53 # Install latest version
41 - 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+)(?=\")')
42 -
43 -
44 - ps -ef | grep plex | grep -v grep
45 - [ $? -eq "0" ] && echo "Plex is running back :)" || echo "Plex is not running ... ;("
54 + 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+)(?=\")') &> /dev/null
55 + # ReStart Plex Service
56 + sudo service plexmediaserver start &> /dev/null
46 57
47 - # Start Plex Service
48 - echo -e " restart service Plex"
49 - sudo service plexmediaserver start
58 + echo -e "$JAUNE Checking Proccess"
59 + pgrep plex &> /dev/null && echo -e "$NC --> Plex is Running well $NC" || echo -e "$ORANGE Houston we have a problem ... Plex Not running ...$NC"
60 + #pgrep plex || echo -e "$ORANGE Houston we have a problem ... Plex Not running ...$NC"
50 61
51 62 # Remove installation package from /tmp folder
52 63 rm /tmp/plexmediaserver_*
64 + echo -e "\n$VERT Plexmediaserver Updated [ $BOLD✔ $VERT] $NC Music is life !\n"

Erreur32 bu gisti düzenledi 7 years ago. Düzenlemeye git

1 file changed, 1 insertion, 2 deletions

Updater-plex.sh

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

Erreur32 bu gisti düzenledi 7 years ago. Düzenlemeye git

1 file changed, 4 insertions, 2 deletions

Updater-plex.sh

@@ -15,13 +15,15 @@
15 15
16 16 # Check Current installed version and exit if latest is already installed
17 17 service=plex
18 + if [[ -z $VersionInstalled ]]; then echo " Plex is not installed - exit "; exit; fi
19 +
20 +
18 21 VersionInstalled=$(dpkg -s plexmediaserver | grep -Po '(?<=Version\: )(\S+)')
19 22 VersionAvailable=$(curl -s "https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=16&distro=ubuntu" | grep -Po '(?<=(\" version=\"))(\S+)(?=(\"))')
20 - echo -e " Checking Plex version ... "
23 + echo -e " Checking $service version ... "
21 24 echo -e " Version installed = $VersionInstalled"
22 25 echo -e " Version Available = $VersionAvailable"
23 26
24 - if [[ -z $VersionInstalled ]]; then echo " Plex is not installed - exit "; exit; fi
25 27 if [ $VersionAvailable = $VersionInstalled ]; then echo "Plex Media Server is already up-to-date (version $VersionInstalled) ... Bye! "; exit; fi
26 28
27 29 echo -e " Download new Version $VersionAvailable"

Erreur32 bu gisti düzenledi 7 years ago. Düzenlemeye git

1 file changed, 51 insertions

Updater-plex.sh(dosya oluşturuldu)

@@ -0,0 +1,51 @@
1 + #!/bin/bash
2 +
3 + #####
4 + #
5 + # This Script will update Plex Media Server to the latest version for Debian/Ubuntu
6 + #
7 + # To automatically check & update plex, run "crontab -e" and add the following lines
8 + #
9 + # # Check for Plex Media Server Updates every day @6:00 am
10 + # 0 6 * * * /root/update-plexmediaserver.sh
11 + #
12 + # 2018 - Original by Matthieu Guerry
13 + # - Customised by erreur32
14 + ###
15 +
16 + # Check Current installed version and exit if latest is already installed
17 + service=plex
18 + VersionInstalled=$(dpkg -s plexmediaserver | grep -Po '(?<=Version\: )(\S+)')
19 + VersionAvailable=$(curl -s "https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=16&distro=ubuntu" | grep -Po '(?<=(\" version=\"))(\S+)(?=(\"))')
20 + echo -e " Checking Plex version ... "
21 + echo -e " Version installed = $VersionInstalled"
22 + echo -e " Version Available = $VersionAvailable"
23 +
24 + if [[ -z $VersionInstalled ]]; then echo " Plex is not installed - exit "; exit; fi
25 + if [ $VersionAvailable = $VersionInstalled ]; then echo "Plex Media Server is already up-to-date (version $VersionInstalled) ... Bye! "; exit; fi
26 +
27 + echo -e " Download new Version $VersionAvailable"
28 + # Download latest installation package to /tmp folder
29 + 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/
30 +
31 + if [[ -z $(ps -ef |grep ${service}) ]]
32 + then
33 + print "Hum service down !?! , anyway Service will updating\n"
34 + else
35 + print "Plex is running, service will stop before Update...\n"
36 + fi
37 + # Stop Plex Service
38 + sudo service plexmediaserver stop
39 + # Install latest version
40 + 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+)(?=\")')
41 +
42 +
43 + ps -ef | grep plex | grep -v grep
44 + [ $? -eq "0" ] && echo "Plex is running back :)" || echo "Plex is not running ... ;("
45 +
46 + # Start Plex Service
47 + echo -e " restart service Plex"
48 + sudo service plexmediaserver start
49 +
50 + # Remove installation package from /tmp folder
51 + rm /tmp/plexmediaserver_*
Daha yeni Daha eski