Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pythonsched [2014/10/26 01:52] (current)
Line 1: Line 1:
 +==== Python scheduler example ====
 +<code lang="​python">​
 +import sched
 +import time
 +import datetime
 +import os
 +
 +__fifteenMins = 15 * 60
 +__cmd = "​sqlplus scott/​tiger@oradb @c:​\madan\sql\update_rows.sql"​
 +s=sched.scheduler(time.time,​ time.sleep)
 +def print_time():​
 + try:
 + print "From print_time",​ datetime.datetime.now()
 + except:
 + print "Abort print_time()"​
 + pass
 +
 +def print_some_times():​
 + try:
 + print datetime.datetime.now()
 + s.enter(__fifteenMins,​ 1, print_time, ())
 + s.run()
 + os.system(__cmd)
 + print_some_times()
 + except:
 + print "​Abort"​
 + pass
 +
 +print_some_times()
 +</​code>​
 +
 +----
 +  * [[pythoninfo|Back to Python]]
  
pythonsched.txt ยท Last modified: 2014/10/26 01:52 (external edit)
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0