Marthee commited on
Commit
9933281
·
verified ·
1 Parent(s): fd4cb96

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -1
app.py CHANGED
@@ -104,5 +104,42 @@ def finddata():
104
  #_________________________________________________________________________________________________________________________
105
  #_________________________________________________________________________________________________________________________
106
 
107
- if __name__ == '__main__':
 
 
108
  app.run(host='0.0.0.0', port=7860)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  #_________________________________________________________________________________________________________________________
105
  #_________________________________________________________________________________________________________________________
106
 
107
+
108
+ def runn():
109
+ # app.run(host="127.0.0.1")
110
  app.run(host='0.0.0.0', port=7860)
111
+ # serve(app, host="127.0.0.1", port=8080)
112
+
113
+
114
+ def keep_alive():
115
+ t=Thread(target=runn)
116
+ t.start()
117
+
118
+ dtn = datetime.datetime.now(datetime.timezone.utc)
119
+ print(dtn)
120
+ next_start = datetime.datetime(dtn.year, dtn.month, dtn.day, 21, 0, 0).astimezone(datetime.timezone.utc) #us - 2 = utc time (21 utc is 19:00 our time and 9 is 7 our time , it needs to run 9 utc time ____ )
121
+ print(next_start)
122
+ keep_alive()
123
+ # active_path = "/TSA Team Folder/ADR Test/Test/"
124
+ while 1:
125
+ # yearly_update()
126
+ dtnNow = datetime.datetime.now(datetime.timezone.utc)
127
+ print(dtnNow)
128
+ if dtnNow >= next_start:
129
+ next_start += datetime.timedelta(hours=12) # 1 day
130
+ print(next_start)
131
+ # print(active_path)
132
+ checkdropbox()
133
+
134
+ # mainDBAlaa.download_NewlyAddedFiles(active_path)
135
+ # do what needs to be done
136
+
137
+ time.sleep(1800)
138
+
139
+ # time.sleep(200)
140
+
141
+ if __name__ == "__main__":
142
+ runn()
143
+ # app.run
144
+ # if __name__ == '__main__':
145
+ # app.run(host='0.0.0.0', port=7860)