diff --git a/app/Console/Commands/Grapper/Sofascore/DaysTournament.php b/app/Console/Commands/Grapper/Sofascore/DaysTournament.php index ece0adfe..12edab5a 100644 --- a/app/Console/Commands/Grapper/Sofascore/DaysTournament.php +++ b/app/Console/Commands/Grapper/Sofascore/DaysTournament.php @@ -34,9 +34,10 @@ class DaysTournament if ($has) { if ($debug) { - Notice::note("$day\nis allready grapped", 'r'); + Notice::note("All tournament for $day have been allready grapped", 'r'); } } else { + if ($debug) { Notice::note("$day\ngrappig", 'g'); } @@ -65,6 +66,10 @@ class DaysTournament $tournament = $row['tournament']; } + if ($debug) { + Notice::note($tournament, 'g'); + } + $category = $tournament['category']; if ($sport_id == 5) { diff --git a/app/Console/Commands/Grapper/Sofascore/Grapper.php b/app/Console/Commands/Grapper/Sofascore/Grapper.php index b4883955..5c99c4f1 100644 --- a/app/Console/Commands/Grapper/Sofascore/Grapper.php +++ b/app/Console/Commands/Grapper/Sofascore/Grapper.php @@ -140,7 +140,7 @@ class Grapper } } } - Notice::note('tournament done', 'bb', 1); + Notice::note('tournament done', 'bb'); } } } diff --git a/apple_damon.sh b/apple_damon.sh index f7ee4557..68b0f7bf 100755 --- a/apple_damon.sh +++ b/apple_damon.sh @@ -2,7 +2,7 @@ case "$1" in "1") # AUTO GRAPPER SOFASCORE (debug) - echo "\n⚽ process $1 task $2" + echo "\n⚽ process function $1 sofa_score_task $2" echo "\n⚽ close all vpn" killall ssh @@ -19,10 +19,10 @@ case "$1" in echo "\n⚽ start task" php artisan nuh --d --f 67 --fun=7 --task=$2 - echo "\n⚽ tournaments for day" + echo "\n⚽ get tournaments for the day" php artisan nuh --d --f 67 --fun=5 --task=$2 - echo "\n⚽ grapper events" + echo "\n⚽ grapper events for the day" php artisan nuh --d --f 67 --fun=6 --task=$2 echo "\n⚽ create zip archive" @@ -54,8 +54,8 @@ case "$1" in echo "--------------------------" echo "apple damon grapper sofascore" echo "--------------------------" - echo "1 => debug max 5sec intervals | print notes | yesterday | soccer task_id:1" - echo "2 => prod max 10sec intervals | no notes | yesterday | soccer | task_id:1" + echo "1 => debug max 5sec intervals" + echo "2 => prod max 10sec intervals" echo "--------------------------" echo "" ;; diff --git a/storage/backup_database/backup_db.sh b/storage/backup_database/backup_db.sh new file mode 100644 index 00000000..550bf535 --- /dev/null +++ b/storage/backup_database/backup_db.sh @@ -0,0 +1,39 @@ +#!/bin/bash +#---------------------------------------- +# MySQL Backup Script +#---------------------------------------- + +# 🔧 Configuration +HOST='localhost' # MySQL server host +USER='root' # Username +PASSWORD='salam' # Password +DB='nutzwerte_fi4' +DAYS_TO_KEEP=60 # Delete backups older than X days +GZIP=1 # 1 = gzip compression, 0 = plain .sql +BACKUP_PATH='/var/www/html/nutzwerte_fi4/storage/backup_database/archive' # Location to store backups +#TIMESTAMP=$(date +"%d_%m_%Y_%H_%M_%S") # Date-time for unique file names +TIMESTAMP=$(date -d "yesterday" +"%d_%m_%Y") #Date-time for previous date file names. reminder here crontab use after 12 am + +#---------------------------------------- + +# Create the backup folder +if [ ! -d $BACKUP_PATH ]; then + mkdir -p $BACKUP_PATH +fi + + + # Backup (with or without compression) + if [ "$GZIP" -eq 0 ]; then + echo "Backing up database: $DB (no compression)" + mysqldump -h "$HOST" -u "$USER" -p"$PASSWORD" --databases "$DB" --single-transaction --quick --extended-insert --compact --hex-blob --max-allowed-packet=256M --net-buffer-length=2M > "$BACKUP_PATH/${DB}-${TIMESTAMP}.sql" + else + echo "Backing up database: $DB (with compression)" + mysqldump -h "$HOST" -u "$USER" -p"$PASSWORD" --databases "$DB" --single-transaction --quick --extended-insert --compact --hex-blob --max-allowed-packet=256M --net-buffer-length=2M | gzip -9 -c > "$BACKUP_PATH/${DB}-${TIMESTAMP}.sql.gz" + fi + + +# Delete old backups +if [ "$DAYS_TO_KEEP" -gt 0 ] ; then + echo "Deleting backups older than $DAYS_TO_KEEP days" + find $BACKUP_PATH/* -mtime +$DAYS_TO_KEEP -exec rm {} \; +fi