接近完善的代码,待生产环境测试。

This commit is contained in:
panjunlan
2026-02-21 14:26:14 +08:00
parent 9024e9c8e4
commit 17e9e0c3bc
11 changed files with 357 additions and 293 deletions

View File

@@ -400,8 +400,8 @@ D:.
│ README.md # 项目描述
├─config # 项目程序配置文件
│ │ config.yaml
│ │ settings.py
│ │ config.yaml # 配置文件
│ │ settings.py # 配置加载和全局变量
├─core # 核心程序
│ │ deleteSnapshots.py
@@ -414,8 +414,8 @@ D:.
│ 2026-02-20-old_snapshots.yaml
│ 2026-02-20_20-36-45-VMsSnapShots_report.xlsx
├─utils # 日志输出格式设置
│ │ logger.py
├─utils # 工具函数
│ │ logger.py # 日志配置
```
@@ -423,11 +423,27 @@ D:.
## 所用到的 Python 库
``` powershell
PS D:\PycharmProjects\RemoveWeeklyShapshot> pip freeze > requirements.txt
openpyxl==3.2.0b1
pandas==3.0.1
pyvmomi==9.0.0.0
PyYAML==6.0.3
```
``` shell
pip install pyVmomi ...
pip install -r requirements.txt
```
## **定时执行**Linux crontab
```bash
# 每月1号凌晨2点执行
0 2 1 * * /usr/bin/python3 /var/RemoveWeeklyShapshot/main.py 2>&1
```