Ver Fonte

报警加上:
check video status

罗俊辉 há 7 meses atrás
pai
commit
3dadd55438
2 ficheiros alterados com 29 adições e 0 exclusões
  1. 18 0
      long_articles_job.sh
  2. 11 0
      threadAliveBot.py

+ 18 - 0
long_articles_job.sh

@@ -99,3 +99,21 @@ else
     nohup python3 updateAccountAvgDaily.py >> /dev/null 2>&1 &
     echo "$(date '+%Y-%m-%d %H:%M:%S') - successfully restart updateAccountAvgDaily.py"
 fi
+
+# 自动更新文章状态
+if pgrep -f "python3 checkVideoStatusDaily.py" > /dev/null
+then
+    echo "$(date '+%Y-%m-%d %H:%M:%S') - python3 checkVideoStatusDaily.py running"
+else
+    echo "$(date '+%Y-%m-%d %H:%M:%S') - trying to restart checkVideoStatusDaily.py"
+    # 切换到指定目录
+    cd /root/luojunhui/LongArticlesJob
+
+    # 激活 Conda 环境
+    source /root/miniconda3/etc/profile.d/conda.sh
+    conda activate tasks
+
+    # 在后台运行 Python 脚本并重定向日志输出
+    nohup python3 checkVideoStatusDaily.py >> /dev/null 2>&1 &
+    echo "$(date '+%Y-%m-%d %H:%M:%S') - successfully restart checkVideoStatusDaily.py"
+fi

+ 11 - 0
threadAliveBot.py

@@ -34,6 +34,8 @@ def threadMonitor():
 
     updatePublishedMsgDaily = [line for line in output.splitlines() if 'python3 updatePublishedMsgDaily.py' in line]
 
+    checkVideoStatusDaily = [line for line in output.splitlines() if 'python3 checkVideoStatusDaily.py' in line]
+
     if not get_off_job:
         bot(
             title="定时任务进程异常挂掉",
@@ -79,6 +81,15 @@ def threadMonitor():
             }
         )
 
+    if not checkVideoStatusDaily:
+        bot(
+            title="定时任务进程异常挂掉",
+            detail={
+                "Job": "checkVideoStatusDaily",
+                "Time": datetime.datetime.now().__str__()
+            }
+        )
+
 
 if __name__ == '__main__':
     while True: