From 20108f4a8c06f2a80a88b3d44ae1aa67a2d20603 Mon Sep 17 00:00:00 2001 From: Yaosanqi137 Date: Mon, 1 Dec 2025 21:54:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BF=98=E8=AE=B0=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E7=BD=91=E8=B4=B9=E7=9A=84=E4=BB=BB=E5=8A=A1=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E4=BA=86:(?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/main.sh b/main.sh index ba978a4..17c50cd 100644 --- a/main.sh +++ b/main.sh @@ -130,18 +130,22 @@ log "服务启动..." check_and_install_dependencies check_and_create_config -# 任务间隔 (秒) +# 电费提醒任务间隔 (秒) INTERVAL_ELEC=7200 # 2小时 LAST_RUN_ELEC=0 +# 网费提醒任务间隔 (秒) +INTERVAL_NET=43200 # 半天 +LAST_RUN_NET=0 + log "进入循环调度模式..." while true; do CURRENT_TIME=$(date +%s) - # 计算时间差 - # 电费监控 + + # 计算时间差 TIME_DIFF=$((CURRENT_TIME - LAST_RUN_ELEC)) if [ $TIME_DIFF -ge $INTERVAL_ELEC ]; then @@ -163,7 +167,11 @@ while true; do LAST_RUN_ELEC=$(date +%s) fi - # 电费监控 + # 网费监控 + + # 计算时间差 + TIME_DIFF=$((CURRENT_TIME - LAST_RUN_NET)) + if [ $TIME_DIFF -ge $INTERVAL_NET ]; then SCRIPT_PATH="$SRC_DIR/internet_monitor.sh"