From bbaaf89a1c42d7780d552ea42ecdfef1382c9896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Tue, 23 Apr 2024 08:45:40 +0200 Subject: [PATCH] offers script fix --- scripts/create_static_pages.sh | 1 + scripts/create_static_pages_offers.sh | 14 +++++++++++--- scripts/cron | 12 ++++++++---- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/scripts/create_static_pages.sh b/scripts/create_static_pages.sh index 7489483c..ea7b08a0 100644 --- a/scripts/create_static_pages.sh +++ b/scripts/create_static_pages.sh @@ -14,6 +14,7 @@ if [ $wget_res -ne 0 ]; then fi find $WEB_DIR -name "*.html" -type f -delete + cp -r ${WEB_TMP_DIR}/127.0.0.1:5000/* ${WEB_DIR}/ rm -r $WEB_TMP_DIR diff --git a/scripts/create_static_pages_offers.sh b/scripts/create_static_pages_offers.sh index 6b8bf786..44f0f6ba 100644 --- a/scripts/create_static_pages_offers.sh +++ b/scripts/create_static_pages_offers.sh @@ -5,7 +5,7 @@ WEB_DIR="/home/ockovani/prd/web/ockovani-covid-pages" mkdir -p $WEB_TMP_DIR -wget -P $WEB_TMP_DIR -e robots=off --adjust-extension http://127.0.0.1:5000/nabidky +wget -r -P $WEB_TMP_DIR -e robots=off --adjust-extension -l 2 -I /nabidky,/praktik,/okres,/kraj http://127.0.0.1:5000/nabidky wget_res=$? if [ $wget_res -ne 0 ]; then @@ -13,10 +13,18 @@ if [ $wget_res -ne 0 ]; then exit $wget_res fi -cp ${WEB_TMP_DIR}/nabidky.html ${WEB_DIR}/ +wget -P $WEB_TMP_DIR/127.0.0.1:5000 -e robots=off --adjust-extension http://127.0.0.1:5000/praktici +wget_res=$? + +if [ $wget_res -ne 0 ]; then + rm -r $WEB_TMP_DIR + exit $wget_res +fi + +cp -r ${WEB_TMP_DIR}/127.0.0.1:5000/* ${WEB_DIR}/ rm -r $WEB_TMP_DIR cd $WEB_DIR || exit 1 git add * -git commit -am "Update" +git commit -am "Update offers" git push origin master diff --git a/scripts/cron b/scripts/cron index a83c6c1f..078663c1 100644 --- a/scripts/cron +++ b/scripts/cron @@ -1,10 +1,14 @@ # daily fetcher -30 6 * * * bash /home/ockovani/prd/app/scripts/execute_action.sh 15481697 -# hourly fetcher -30 7-22 * * * bash /home/ockovani/prd/app/scripts/execute_action.sh 15481698 +20 6 * * * bash /home/ockovani/prd/app/scripts/execute_action.sh 15481697 + +# hourly fetcher - disabled, centers probably don't update that often +# 30 7-22 * * * bash /home/ockovani/prd/app/scripts/execute_action.sh 15481698 + # monthly fetcher 00 5 5 * * bash /home/ockovani/prd/app/scripts/execute_action.sh 16635318 + # update GP page -1/5 * * * * bash /home/ockovani/prd/app/scripts/execute_action.sh 94783487 +2/5 * * * * bash /home/ockovani/prd/app/scripts/execute_action.sh 94783487 + # post tweet - disabled # 35 7 * * * bash /home/ockovani/prd/app/scripts/execute_action.sh 6797956