fix per quando il link è mezzo rotto
This commit is contained in:
@@ -4,9 +4,17 @@
|
||||
# Es: PWD_SC="/var/www/html/streamingcommunity"
|
||||
PWD_SC="$PWD"
|
||||
|
||||
# Se il link è cambiato, allora aggiorna il file "attuale.txt"
|
||||
# Segue link per vedere se è stato aggiornato...
|
||||
attuale="$(cat "$PWD_SC/attuale.txt")"
|
||||
nuovo=$(curl --no-progress-meter -L $attuale | sed -n 's/.*\(https:\/\/cdn\.streamingcommunity\.[^ ]*images[^ ]*\).*/\1/p' | grep -oP 'streamingcommunity\.\w+(\.\w+)?')
|
||||
|
||||
# Se il nuovo link è vuoto, ci sono casini in corso, lascia il vecchio link ed esce
|
||||
if [ -z "$nuovo" ]; then
|
||||
echo "STANNO FACENDO CASINI. LASCIATO IL VECCHIO LINK"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Altrimenti aggiorna il file "attuale.txt"
|
||||
if [ "$attuale" != "$nuovo" ]; then
|
||||
attuale="$nuovo"
|
||||
echo "$attuale" > $PWD_SC/attuale.txt
|
||||
|
||||
12
show_link.sh
12
show_link.sh
@@ -3,9 +3,17 @@
|
||||
# SETTARE QUESTA VARIABILE SE LO SCRIPT NON VIENE USATO IN LOCALE:
|
||||
PWD_SC="$PWD"
|
||||
|
||||
# Se il link è cambiato, allora aggiorna il file "attuale.txt"
|
||||
attuale=$(<$PWD_SC/attuale.txt)
|
||||
# Segue link per vedere se è stato aggiornato...
|
||||
attuale="$(cat "$PWD_SC/attuale.txt")"
|
||||
nuovo=$(curl --no-progress-meter -L $attuale | sed -n 's/.*\(https:\/\/cdn\.streamingcommunity\.[^ ]*images[^ ]*\).*/\1/p' | grep -oP 'streamingcommunity\.\w+(\.\w+)?')
|
||||
|
||||
# Se il nuovo link è vuoto, ci sono casini in corso, lascia il vecchio link ed esce
|
||||
if [ -z "$nuovo" ]; then
|
||||
echo "STANNO FACENDO CASINI. LASCIATO IL VECCHIO LINK"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Altrimenti aggiorna il file "attuale.txt"
|
||||
if [ "$attuale" != "$nuovo" ]; then
|
||||
attuale="$nuovo"
|
||||
echo "$attuale" > $PWD_SC/attuale.txt
|
||||
|
||||
Reference in New Issue
Block a user