From b75a49e26cf037636d2deced40ceb7dd0d524a35 Mon Sep 17 00:00:00 2001 From: scossa Date: Mon, 13 Jan 2025 18:50:02 +0100 Subject: [PATCH] up --- update_link.sh | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/update_link.sh b/update_link.sh index cab337e..18324d9 100755 --- a/update_link.sh +++ b/update_link.sh @@ -1,16 +1,21 @@ #!/bin/bash -PWD_SC="/var/www/scommunity" -attuale="$(cat "$PWD_SC/attuale.txt")" -nuovo=$(curl -L $attuale | sed -n 's/.*\(https:\/\/cdn\.streamingcommunity\.[^ ]*images[^ ]*\).*/\1/p' | grep -oP 'streamingcommunity\.\w+(\.\w+)?') +# SETTARE QUESTA VARIABILE CON IL PERCORSO GIUSTO: +PWD_SC="/var/www/html/StreamingCommunity" +# Se il link รจ stato aggiornato, aggiorna il file "attuale.txt" +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+)?') if [ "$attuale" != "$nuovo" ]; then attuale="$nuovo" echo "$attuale" > $PWD_SC/attuale.txt - fi + +# Formatta il link e lo stampa formatted="https://$(cat "$PWD_SC/attuale.txt")" -echo "$formatted" +echo "$formatted" #per debug + +# Crea pagina "index.html" cat <<- _EOF > $PWD_SC/index.html @@ -72,9 +77,9 @@ cat <<- _EOF > $PWD_SC/index.html



@@ -86,9 +91,9 @@ cat <<- _EOF > $PWD_SC/index.html



@@ -99,4 +104,5 @@ cat <<- _EOF > $PWD_SC/index.html _EOF -sudo chown -R www-data:www-data /$PWD_SC ; sudo chmod -R 755 $PWD_SC \ No newline at end of file +# Da i permessi alla cartella di sc +sudo chown -R www-data:www-data $PWD_SC ; sudo chmod -R 755 $PWD_SC \ No newline at end of file