add:初始化工程
This commit is contained in:
25
auto_update_vueip.py
Normal file
25
auto_update_vueip.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from utilities.pushVueIp import IPMonitor
|
||||
import logging
|
||||
import sys
|
||||
import ctypes
|
||||
ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 0) # 强制隐藏
|
||||
|
||||
# 配置日志
|
||||
logging.basicConfig(
|
||||
filename='E:\\PythonCode\\hstools\\auto_update_vueip.log',
|
||||
level=logging.INFO,
|
||||
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||
)
|
||||
|
||||
def main():
|
||||
try:
|
||||
monitor = IPMonitor(ip_storage_file='E:\PythonCode\hstools\last_ip.txt')
|
||||
changed, success, ip = monitor.check_and_push()
|
||||
logging.info(f"IP检查结果: 变化={changed}, 成功={success}, IP={ip}")
|
||||
except Exception as e:
|
||||
logging.error(f"执行失败: {e}")
|
||||
finally:
|
||||
sys.exit(0) # 👈 确保脚本退出
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user