/usr/share/doc/python-apscheduler/examples/threaded.py is in python-apscheduler 2.1.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | """
Basic example showing how the scheduler integrates with the application it's
running alongside with.
"""
from datetime import datetime
import time
from apscheduler.scheduler import Scheduler
def tick():
print('Tick! The time is: %s' % datetime.now())
if __name__ == '__main__':
scheduler = Scheduler()
scheduler.add_interval_job(tick, seconds=3)
print('Press Ctrl+C to exit')
scheduler.start()
# This is here to simulate application activity (which keeps the main
# thread alive).
while True:
print('This is the main thread.')
time.sleep(2)
|