Advertisement
MD500_Pilot

Untitled

Apr 14th, 2020
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.87 KB | None | 0 0
  1. import sys
  2. sys.path.append('/var/www/gardenpi_control/gardenpi')
  3. sys.path.append('/var/www/gardenpi_control/gardenpi/utilities')
  4. from time import sleep
  5.  
  6.  
  7. from apscheduler.schedulers.background import BackgroundScheduler
  8. import logging
  9.  
  10. logging.basicConfig()
  11. logging.getLogger('apscheduler').setLevel(logging.DEBUG)
  12.  
  13. scheduler = BackgroundScheduler()
  14. scheduler.configure(timezone='America/Phoenix')
  15. scheduler.add_jobstore('sqlalchemy', url=system_info.sqlalchemy_apscheduler, tablename='apscheduler_jobs')
  16.  
  17. #zone1 = ZoneController('zone1')
  18.  
  19. def mytestfunction():
  20.     print('This is a test')
  21.  
  22. def add_zone_job(myfunc, time):
  23.     scheduler.add_job(mytestfunction, 'interval', minutes=time)
  24.  
  25.  
  26. if __name__ == '__main__':
  27.     scheduler.start()
  28.     try:
  29.         while True:
  30.             sleep(5)
  31.     except (KeyboardInterrupt, SystemExit):
  32.         scheduler.shutdown()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement