暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

supervisor.py 945B

12345678910111213141516171819202122232425
  1. import time
  2. import logging
  3. from xls2table import run_htp
  4. from apscheduler.schedulers.blocking import BlockingScheduler
  5. def attendance_job():
  6. print('Apscheduler Runtime: '+time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())))
  7. FMT = '%(asctime)s %(filename)s %(funcName)s %(levelname)s %(message)s'
  8. logging.basicConfig(format=FMT, level=logging.INFO)
  9. run_htp(url='http://192.168.80.3:8069', dbname='htp', dburl='postgresql://odoo:odootyughj@192.168.80.3:5432/htp')
  10. #sched = BlockingScheduler()
  11. sched = BlockingScheduler(daemon=True)
  12. #sched.add_job(attendance_job, 'interval', seconds=5)
  13. #sched.add_job(attendance_job, 'cron', hour=23, minute=30, timezone='Asia/Taipei')
  14. sched.add_job(attendance_job, 'cron', hour=8, minute=35, timezone='Asia/Taipei')
  15. #sched.add_job(attendance_job, 'cron', hour=18, minute=10, timezone='Asia/Taipei')
  16. try:
  17. sched.start()
  18. except (KeyboardInterrupt, SystemExit):
  19. sched.shutdown()