From 9de0be68b0bdab7eee69c34d2700bb5f322515a9 Mon Sep 17 00:00:00 2001 From: yungwine Date: Thu, 21 Nov 2024 18:53:48 +0800 Subject: [PATCH] remove cleanup cmd --- mytonctrl/mytonctrl.py | 7 ------ mytonctrl/resources/translate.json | 5 ----- mytonctrl/scripts/cleanup.sh | 35 ------------------------------ 3 files changed, 47 deletions(-) delete mode 100644 mytonctrl/scripts/cleanup.sh diff --git a/mytonctrl/mytonctrl.py b/mytonctrl/mytonctrl.py index de3d7ce8..c185baad 100755 --- a/mytonctrl/mytonctrl.py +++ b/mytonctrl/mytonctrl.py @@ -140,7 +140,6 @@ def inject_globals(func): module = AlertBotModule(ton, local) module.add_console_commands(console) - console.AddItem("cleanup", inject_globals(cleanup_validator_db), local.translate("cleanup_cmd")) console.AddItem("benchmark", inject_globals(run_benchmark), local.translate("benchmark_cmd")) # console.AddItem("activate_ton_storage_provider", inject_globals(activate_ton_storage_provider), local.translate("activate_ton_storage_provider_cmd")) @@ -403,12 +402,6 @@ def rollback_to_mtc1(local, ton, args): local.exit() #end define -def cleanup_validator_db(ton, args): - cleanup_script_path = pkg_resources.resource_filename('mytonctrl', 'scripts/cleanup.sh') - run_args = ["bash", cleanup_script_path] - exit_code = run_as_root(run_args) -#end define - def run_benchmark(ton, args): timeout = 200 benchmark_script_path = pkg_resources.resource_filename('mytonctrl', 'scripts/benchmark.sh') diff --git a/mytonctrl/resources/translate.json b/mytonctrl/resources/translate.json index 22915e59..83752783 100644 --- a/mytonctrl/resources/translate.json +++ b/mytonctrl/resources/translate.json @@ -484,11 +484,6 @@ "ru": "Отправить тестовое оповещение через Telegram Bot", "zh_TW": "通過 Telegram Bot 發送測試警報" }, - "cleanup_cmd": { - "en": "Clean node old logs and temp files", - "ru": "Очистить старые логи и временные файлы ноды", - "zh_TW": "清理節點舊日誌和臨時文件" - }, "benchmark_cmd": { "en": "Run benchmark", "ru": "Запустить бенчмарк", diff --git a/mytonctrl/scripts/cleanup.sh b/mytonctrl/scripts/cleanup.sh deleted file mode 100644 index d3d10a2e..00000000 --- a/mytonctrl/scripts/cleanup.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -set -e - -# Проверить sudo -if [ "$(id -u)" != "0" ]; then - echo "Please run script as root" - exit 1 -fi - -# Цвета -COLOR='\033[92m' -ENDC='\033[0m' - -db_path=/var/ton-work/db - -function get_directory_size { - buff=$(du -sh ${db_path} | awk '{print $1}') - echo ${buff} -} - -echo -e "${COLOR}[1/7]${ENDC} Start node/validator DB cleanup process" -echo -e "${COLOR}[2/7]${ENDC} Stop node/validator" -systemctl stop validator - -echo -e "${COLOR}[3/7]${ENDC} Node/validator DB size before cleanup = $(get_directory_size)" -find /var/ton-work/db -name 'LOG.old*' -exec rm {} + - -echo -e "${COLOR}[4/7]${ENDC} Node/validator DB size after deleting old files = $(get_directory_size)" -rm -r /var/ton-work/db/files/packages/temp.archive.* - -echo -e "${COLOR}[5/7]${ENDC} Node/validator DB size after deleting temporary files = $(get_directory_size)" -echo -e "${COLOR}[6/7]${ENDC} Start node/validator" -systemctl start validator - -echo -e "${COLOR}[7/7]${ENDC} Node/validator DB cleanup process completed"