wangkun před 2 roky
rodič
revize
99c932a5ef

+ 4 - 4
gongzhonghao/gongzhonghao_follow/gongzhonghao_follow.py

@@ -117,12 +117,12 @@ class GongzhonghaoFollow:
                 if r.json()["base_resp"]["err_msg"] == "invalid session" and 21 >= datetime.datetime.now().hour >= 10:
                     Common.logger(log_type, crawler).info(f"status_code:{r.status_code}")
                     Common.logger(log_type, crawler).warning(f"get_gzh_url:{r.text}\n")
-                    Feishu.bot(log_type, crawler, "token过期啦,请扫码更换\nhttps://mp.weixin.qq.com/")
+                    Feishu.bot(log_type, crawler, "token过期啦,请扫码更换token\nhttps://mp.weixin.qq.com/")
                     time.sleep(60 * 10)
                 elif r.json()["base_resp"]["err_msg"] == "freq control" and 21 >= datetime.datetime.now().hour >= 10:
                     Common.logger(log_type, crawler).info(f"status_code:{r.status_code}")
                     Common.logger(log_type, crawler).warning(f"get_gzh_url:{r.text}\n")
-                    Feishu.bot(log_type, crawler, "公众号频控啦,请扫码更换\nhttps://mp.weixin.qq.com/")
+                    Feishu.bot(log_type, crawler, "公众号频控啦,请扫码更换其他公众号token\nhttps://mp.weixin.qq.com/")
                     time.sleep(60 * 10)
                 else:
                     break
@@ -237,12 +237,12 @@ class GongzhonghaoFollow:
                     if r.json()["base_resp"]["err_msg"] == "invalid session" and 21 >= datetime.datetime.now().hour >= 10:
                         Common.logger(log_type, crawler).info(f"status_code:{r.status_code}")
                         Common.logger(log_type, crawler).info(f"response:{r.text}")
-                        Feishu.bot(log_type, crawler, "token过期啦,请扫码更换\nhttps://mp.weixin.qq.com/")
+                        Feishu.bot(log_type, crawler, "token过期啦,请扫码更换token\nhttps://mp.weixin.qq.com/")
                         time.sleep(60 * 10)
                     elif r.json()["base_resp"]["err_msg"] == "freq control" and 21 >= datetime.datetime.now().hour >= 10:
                         Common.logger(log_type, crawler).info(f"status_code:{r.status_code}")
                         Common.logger(log_type, crawler).warning(f"get_gzh_url:{r.text}\n")
-                        Feishu.bot(log_type, crawler, "公众号频控啦,请扫码更换\nhttps://mp.weixin.qq.com/")
+                        Feishu.bot(log_type, crawler, "公众号频控啦,请扫码更换其他公众号token\nhttps://mp.weixin.qq.com/")
                         time.sleep(60 * 10)
                     else:
                         break

+ 14 - 24
main/process.sh

@@ -93,33 +93,23 @@ else
   echo "$(date "+%Y-%m-%d %H:%M:%S") 快手定向爬虫策略 进程状态正常\n" >> ${log_path}
 fi
 
-## 西瓜定向爬虫策略
-#echo "$(date "+%Y-%m-%d %H:%M:%S") 正在监测 西瓜定向爬虫策略 进程状态" >> ${log_path}
-#ps -ef | grep "run_xigua_follow.py" | grep -v "grep"
-#if [ "$?" -eq 1 ];then
-#  echo "$(date "+%Y-%m-%d_%H:%M:%S") 异常停止,正在重启!" >> ${log_path}
-#  if [ ${env} = "dev" ];then
-#    cd ${piaoquan_crawler_dir} && sh main/scheduling_main.sh ./xigua/xigua_main/run_xigua_follow.py --log_type="follow" --crawler="xigua" --env="dev" xigua/follow.log
-#  else
-#    cd ${piaoquan_crawler_dir} && /usr/bin/sh ./main/main.sh ./xigua/xigua_main/run_xigua_follow.py --log_type="follow" --crawler="xigua" --strategy="定向爬虫策略" --oss_endpoint="inner" --env="prod" --machine="aliyun" xigua/follow.log
-#  fi
-#  echo "$(date "+%Y-%m-%d %H:%M:%S") 重启完成!\n" >> ${log_path}
-#else
-#  echo "$(date "+%Y-%m-%d %H:%M:%S") 西瓜定向爬虫策略 进程状态正常\n" >> ${log_path}
-#fi
-
-
+# 西瓜定向爬虫策略
+echo "$(date "+%Y-%m-%d %H:%M:%S") 正在监测 西瓜定向爬虫策略 进程状态" >> ${log_path}
+ps -ef | grep "run_xigua_follow.py" | grep -v "grep"
+if [ "$?" -eq 1 ];then
+  echo "$(date "+%Y-%m-%d_%H:%M:%S") 异常停止,正在重启!" >> ${log_path}
+  if [ ${env} = "dev" ];then
+    cd ${piaoquan_crawler_dir} && sh main/scheduling_main.sh ./xigua/xigua_main/run_xigua_follow.py --log_type="follow" --crawler="xigua" --env="dev" xigua/follow.log
+  else
+    cd ${piaoquan_crawler_dir} && /usr/bin/sh ./main/main.sh ./xigua/xigua_main/run_xigua_follow.py --log_type="follow" --crawler="xigua" --strategy="定向爬虫策略" --oss_endpoint="inner" --env="prod" --machine="aliyun" xigua/follow.log
+  fi
+  echo "$(date "+%Y-%m-%d %H:%M:%S") 重启完成!\n" >> ${log_path}
+else
+  echo "$(date "+%Y-%m-%d %H:%M:%S") 西瓜定向爬虫策略 进程状态正常\n" >> ${log_path}
+fi
 
 # 删除日志
 echo "$(date "+%Y-%m-%d %H:%M:%S") 开始清理 5 天前的日志文件" >> ${log_path}
 find ${piaoquan_crawler_dir}main/main_logs/ -mtime +5 -name "*.log" -exec rm -rf {} \;
 echo "$(date "+%Y-%m-%d %H:%M:%S") 日志文件清理完毕\n" >> ${log_path}
 exit 0
-
-# sh main/process.sh "dev"
-# ps aux | grep run_xiaoniangao
-# ps aux | grep run_xiaoniangao | grep -v grep | awk '{print $2}' | xargs kill -9
-
-# ps aux | grep run_gongzhonghao
-# ps aux | grep run_gongzhonghao | grep -v grep | awk '{print $2}' | xargs kill -9
-