up
This commit is contained in:
@@ -3,13 +3,14 @@
|
|||||||
```
|
```
|
||||||
# Per generare la pagina index.html contente il link giusto (richiede "attuale.txt"):
|
# Per generare la pagina index.html contente il link giusto (richiede "attuale.txt"):
|
||||||
|
|
||||||
|
# 0. Setta la variabile "PWD_SC" in testa allo script o lasciala con "PWD" per provarla in locale
|
||||||
|
|
||||||
# 1. Avvia lo script manualmente
|
# 1. Avvia lo script manualmente
|
||||||
./update_link.sh
|
./update_link.sh
|
||||||
|
|
||||||
# 2. o mettilo in cron
|
# 2. o mettilo in cron
|
||||||
0 0 * * * /path/to/update_link.sh
|
0 0 * * * /path/to/update_link.sh
|
||||||
|
|
||||||
|
|
||||||
#Se vuoi pubblicarla sul web, dai i permessi alla cartella contenente lo script:
|
#Se vuoi pubblicarla sul web, dai i permessi alla cartella contenente lo script:
|
||||||
sudo chown -R www-data:www-data <path_to_streamingcommunity_directory> ; sudo chmod -R 755 <path_to_streamingcommunity_directory>
|
sudo chown -R www-data:www-data <path_to_streamingcommunity_directory> ; sudo chmod -R 755 <path_to_streamingcommunity_directory>
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
attuale=$(<$PWD/attuale.txt)
|
PWD_SC="$PWD"
|
||||||
|
|
||||||
|
attuale=$(<$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+)?')
|
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
|
if [ "$attuale" != "$nuovo" ]; then
|
||||||
attuale="$nuovo"
|
attuale="$nuovo"
|
||||||
echo "$attuale" > $PWD/attuale.txt
|
echo "$attuale" > $PWD_SC/attuale.txt
|
||||||
fi
|
fi
|
||||||
echo -e "\n $attuale\n"
|
echo -e "\n $attuale\n"
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
attuale=$(</var/www/html/scommunity/attuale.txt)
|
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+)?')
|
nuovo=$(curl -L $attuale | sed -n 's/.*\(https:\/\/cdn\.streamingcommunity\.[^ ]*images[^ ]*\).*/\1/p' | grep -oP 'streamingcommunity\.\w+(\.\w+)?')
|
||||||
|
|
||||||
if [ "$attuale" != "$nuovo" ]; then
|
if [ "$attuale" != "$nuovo" ]; then
|
||||||
attuale="$nuovo"
|
attuale="$nuovo"
|
||||||
echo "$attuale" > /var/www/html/scommunity/attuale.txt
|
echo "$attuale" > $PWD_SC/attuale.txt
|
||||||
|
|
||||||
fi
|
fi
|
||||||
formatted="https://$(<//var/www/html/scommunity/attuale.txt)"
|
formatted="https://$(cat "$PWD_SC/attuale.txt")"
|
||||||
echo "$formatted"
|
echo "$formatted"
|
||||||
cat <<- _EOF > /var/www/html/scommunity/index.html
|
cat <<- _EOF > $PWD_SC/index.html
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
@@ -98,4 +99,4 @@ cat <<- _EOF > /var/www/html/scommunity/index.html
|
|||||||
</html>
|
</html>
|
||||||
_EOF
|
_EOF
|
||||||
|
|
||||||
sudo chown -R www-data:www-data /var/www/html/scommunity ; sudo chmod -R 755 /var/www/html/scommunity
|
sudo chown -R www-data:www-data /$PWD_SC ; sudo chmod -R 755 $PWD_SC
|
||||||
Reference in New Issue
Block a user