1234567891011121314151617181920 |
- import sys
- import random
- import os
- import time
- import fire
- import dataset
- from datetime import datetime
- import pymysql
- pymysql.install_as_MySQLdb()
- db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
- cursor = db.query('select dt from seo.google_rank order by id desc limit 1')
- for c in cursor:
- last_time = c['dt']
-
- diff = datetime.now() - last_time
- if diff.seconds > 600:
- print('異常,啟動reboot.py')
- os.system('python3 reboot.py')
- print('正常')
|