feat: 添加日志清理脚本及使用说明文档

添加自动清理qimen日志的脚本和详细使用说明
包含定时任务配置方法和时间格式说明
This commit is contained in:
2025-06-17 16:12:15 +08:00
commit 87ccaaa5a2
2 changed files with 46 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
# 日志清理脚本使用说明
## 脚本功能
本脚本用于自动清理 `/home/data/www/ipos/logs/qimen_log/` 目录下的 `.txt` 日志文件。
## 使用方法
1. 将脚本上传到服务器
2. 给脚本执行权限:
```bash
chmod +x /path/to/clean_logs.sh
```
3. 测试脚本运行:
```bash
/path/to/clean_logs.sh
```
## 设置定时任务
1. 编辑crontab
```bash
crontab -e
```
2. 添加定时任务(每天22点执行):
```
0 22 * * * /path/to/clean_logs.sh
```
## 自定义执行时间
crontab时间格式说明:
```
* * * * *
- - - - -
| | | | |
| | | | +----- 星期几 (0 - 6) (周日=0)
| | | +---------- 月份 (1 - 12)
| | +--------------- 日 (1 - 31)
| +-------------------- 小时 (0 - 23)
+------------------------- 分钟 (0 - 59)
```
示例:
- 每天10:30执行:`30 10 * * *`
- 每周一8:00执行:`0 8 * * 1`
- 每月1日午夜执行:`0 0 1 * *`
+3
View File
@@ -0,0 +1,3 @@
#!/bin/bash
# Clear qimen logs at 10pm daily
find /home/data/www/ipos/logs/qimen_log/ -type f -name "*.txt" -delete