Sindbad~EG File Manager
from flask import Flask
from flask_apscheduler import APScheduler
import os
import datetime
from datetime import timedelta,date,datetime,time
app = Flask(__name__)
scheduler = APScheduler()
def scheduleTask():
now = datetime.now()
dt_string_1 = "2021-03-15 17:10"
dt_string = now.strftime("%Y-%m-%d %H:%M")
print(dt_string)
if dt_string == dt_string_1:
print("ConditionTrue")
print("This test runs every 3 seconds")
print("Hi boss your count down is correct ...")
def background_schedule():
from apscheduler.schedulers.background import BackgroundScheduler
def tick():
print('Tick! The time is: %s' % datetime.now())
scheduler = BackgroundScheduler()
# scheduler.add_job(tick, 'interval', seconds=3)
# scheduler.start()
print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C'))
try:
# This is here to simulate application activity (which keeps the main thread alive).
while True:
# time.sleep(2)
pass
except (KeyboardInterrupt, SystemExit):
# Not strictly necessary if daemonic mode is enabled but should be done if possible
scheduler.shutdown()
if __name__ == '__main__':
scheduler.shutdown()
scheduler.add_job(id = 'Scheduled Task', func=scheduleTask, trigger="interval", seconds=60)
scheduler.start()
app.run(host='127.0.0.1',port=5003,debug=True)
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists