代码拉取完成,页面将自动刷新
import asyncio
import sys
from MroFtpClass import *
from TaskLogClass import *
async def handle_user_input():
global ftp_scan_thread
status = ThreadInfo('main')
while True:
cmd = await asyncio.get_event_loop().run_in_executor(None, input, "Enter command (start, stop): ")
if cmd == "start":
if not ftp_scan_thread or not ftp_scan_thread.is_alive():
ftp_scan_thread = FtpScanThread(status, interval=1)
ftp_scan_thread.daemon = True
ftp_scan_thread.start()
print("Thread started.")
else:
print("Thread is started.")
elif cmd == "stop":
if ftp_scan_thread and ftp_scan_thread.is_alive():
ftp_scan_thread.stop()
ftp_scan_thread.join()
print("Thread stopped.")
else:
print("Thread is not started.")
elif cmd == "exit":
if ftp_scan_thread and ftp_scan_thread.is_alive():
ftp_scan_thread.stop()
ftp_scan_thread.join()
print("Thread stopped.")
sys.exit()
elif cmd == 'del':
DownLog().dellog_by_time('2023-03-09 10:00:00')
else:
print("Invalid command. Please enter 'start' or 'stop'.")
if __name__ == '__main__':
mysql = MysqlInfo()
ftp = FTPInfo()
mysql.update(host='localhost', port=3306, user='root', passwd='242520')
ftp.update(ftp_name='test',
host='172.29.106.147',
port=21,
user='nixevol',
passwd='242520',
sync_path='/sync/',
down_path=os.path.join(os.getcwd(), 'sync'),
scan_filter='tmp|temp')
mysql.check()
ftp_scan_thread = None
DownLog().dellog_by_time()
asyncio.run(handle_user_input())
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。