From def9d5a0168384e77b86bf4be10d4d714036ee87 Mon Sep 17 00:00:00 2001 From: Vladless Date: Mon, 21 Oct 2024 01:23:27 +0300 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B5=D0=B7=D0=B5=D1=80=D0=B2=D0=BD?= =?UTF-8?q?=D1=8B=D0=B5=20=D0=BA=D0=BE=D0=BF=D0=B8=D0=B8=20=D0=B1=D0=B0?= =?UTF-8?q?=D0=B7=D1=8B=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D0=B8=20?= =?UTF-8?q?=D1=83=D0=B2=D0=B5=D0=B4=D0=BE=D0=BC=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 +++- backup_pg copy.sh | 13 +++++++++++++ handlers/notifications.py | 4 ++-- 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 backup_pg copy.sh diff --git a/.gitignore b/.gitignore index fb38d4ca..4016cb72 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,6 @@ /database.db /bot_old.py /bot_old_2.py -/database.db \ No newline at end of file +/database.db +/backup_pg.sh +/config copy.py \ No newline at end of file diff --git a/backup_pg copy.sh b/backup_pg copy.sh new file mode 100644 index 00000000..d12bc6c7 --- /dev/null +++ b/backup_pg copy.sh @@ -0,0 +1,13 @@ +# Параметры +DB_NAME="имя_вашей_базы" +USER="имя_пользователя_postgresql" +HOST="localhost" +BACKUP_DIR="/путь/к/папке/резервных_копий" +DATE=$(date +\%Y-\%m-\%d-\%H\%M\%S) +BACKUP_FILE="$BACKUP_DIR/$DB_NAME-backup-$DATE.sql" + +# Команда для резервного копирования +pg_dump -U $USER -h $HOST -F c -f $BACKUP_FILE $DB_NAME + +# Удаление старых копий (например, старше 7 дней) +find $BACKUP_DIR -type f -name "*.sql" -mtime +7 -exec rm {} \; \ No newline at end of file diff --git a/handlers/notifications.py b/handlers/notifications.py index c5f9b4ee..a80e37ab 100644 --- a/handlers/notifications.py +++ b/handlers/notifications.py @@ -46,7 +46,7 @@ async def notify_expiring_keys(bot: Bot): ], [ InlineKeyboardButton(text='6 месяцев (540 руб.)', callback_data=f'renew_plan|6|{record["client_id"]}'), - InlineKeyboardButton(text='1 год (1080 руб.)', callback_data=f'renew_plan|12|{record["client_id"]}') + InlineKeyboardButton(text='1 год (1000 руб.)', callback_data=f'renew_plan|12|{record["client_id"]}') ], [ InlineKeyboardButton(text='Пополнить баланс', callback_data='replenish_balance'), @@ -120,4 +120,4 @@ async def notify_expiring_keys(bot: Bot): finally: await conn.close() except Exception as e: - print(f"Ошибка при отправке уведомлений: {e}") + print(f"Ошибка при отправке уведомлений: {e}") \ No newline at end of file