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