32 lines
730 B
Python
32 lines
730 B
Python
import asyncio
|
|
import aiohttp
|
|
import schedule
|
|
import time
|
|
import random
|
|
import threading
|
|
|
|
from config import App
|
|
|
|
def main():
|
|
print("Script is running...")
|
|
|
|
def run_scheduler():
|
|
while True:
|
|
schedule.run_pending()
|
|
time.sleep(1)
|
|
|
|
if __name__ == '__main__':
|
|
# Schedule the script to run every day at a specific time
|
|
print(f'Repos downloading is scheduled on {App.ScheduleTime}')
|
|
schedule.every().day.at(App.ScheduleTime).do(lambda: main())
|
|
|
|
# Run the scheduler in a separate thread
|
|
scheduler_thread = threading.Thread(target=run_scheduler)
|
|
scheduler_thread.start()
|
|
|
|
# Keep the main thread running
|
|
try:
|
|
scheduler_thread.join()
|
|
except KeyboardInterrupt:
|
|
pass
|