zooeytsai %!s(int64=2) %!d(string=hai) anos
pai
achega
c4146e9ee0
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  1. 3 3
      monitor/mon_chro.py

+ 3 - 3
monitor/mon_chro.py

@@ -11,7 +11,7 @@ from datetime import datetime
 d = ['hhh.com.tw','innews.com.tw']
 db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
 cursor_rank = db.query('select dt from seo.google_rank order by id desc limit 1')
-cursor_general = db.query('select domain from seo.general_log order by id desc limit 5')
+cursor_general = db.query('select domain from seo.general_log order by id desc limit 10')
 for c in cursor_rank:
     last_time = c['dt']
 diff = datetime.now() - last_time
@@ -25,10 +25,10 @@ for c in cursor_general:
     if c['domain'] not in d:
         lst.append(1)
 if len(lst) > 0:
+    print('general正常')
+else:
     print('general異常,啟動reboot.py')
     os.system('python3 reboot.py')
-else:
-    print('general正常')