This commit is contained in:
Daniil Gentili 2019-04-22 10:46:38 +00:00
parent f1a0d1d409
commit dd466e4ab9
2 changed files with 16 additions and 12 deletions

View File

@ -1,16 +1,15 @@
#!/bin/bash #!/bin/bash
[ $(id -u) -ne 0 ] { echo "This script has to be run as root"; exit 1; }
service nginx stop sudo service nginx stop
rm /etc/nginx/sites-enabled/default sudo rm -rf /etc/nginx/sites-enabled/default
rm /etc/nginx/conf.d/default sudo rm -rf /etc/nginx/conf.d/default
HTTP=" server {\n HTTP=" server {\n
listen 80 default_server;\n listen 8808 default_server;\n
listen [::]:80 default_server;\n listen [::]:8808 default_server;\n
server_name $DOMAIN;\n server_name localhost;\n
ssi on;\n ssi on;\n
root $PWD/yay;\n root $PWD/ypmirror;\n
error_page 404 /sorry/404.php;\n error_page 404 /sorry/404.php;\n
error_page 403 /sorry/403.php;\n error_page 403 /sorry/403.php;\n
autoindex off;\n autoindex off;\n
@ -23,11 +22,15 @@ HTTP=" server {\n
types { text/html php; }\n types { text/html php; }\n
} \n } \n
}" }"
echo -e $HTTP > /etc/nginx/conf.d/yp.conf echo -e $HTTP > yp.conf
service nginx start sudo mv yp.conf /etc/nginx/conf.d/yp.conf
sudo service nginx start
sudo cp script.sh /usr/bin/yayponies-update.sh
yayponies-update.sh $PWD localhost:8808
co script.sh /usr/bin/yayponies-update.sh
crontab -l > /tmp/yayponies-cron crontab -l > /tmp/yayponies-cron
sed -i '/yayponies-update/d' /tmp/yayponies-cron
echo "*/10 * * * * /usr/bin/yayponies-update.sh $PWD localhost:8808" >> /tmp/yayponies-cron echo "*/10 * * * * /usr/bin/yayponies-update.sh $PWD localhost:8808" >> /tmp/yayponies-cron
crontab /tmp/yayponies-cron crontab /tmp/yayponies-cron
rm /tmp/yayponies-cron rm /tmp/yayponies-cron

View File

@ -4,7 +4,8 @@ git reset --hard
git pull origin master git pull origin master
for f in $(find . -type f -name '*.php'); do for f in $(find . -type f -name '*.php'); do
curl "$2/$f" -so $f curl "$2/$f" -so "$f"
mv "$f" "${f/php/html}"
done done
cd .. cd ..