From 10e38f238e7ce28f06348b8b648e87cba45e96cb Mon Sep 17 00:00:00 2001 From: xin053 <13207130066.cool@163.com> Date: Thu, 11 Jun 2020 12:26:16 +0800 Subject: [PATCH] update README --- README.md | 2 ++ hosts.yaml | 2 ++ switchbackup.py | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 44a3bb1..32320b2 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,9 @@ pip3 install -r requirements.txt 支持的 `type` 有 `h3c, huawei, ruijie, cisco` ```yaml +# 备份文件保存路径 backup_path: '/home/xin053/swConfigBackup' +# 备份文件保存时长, 单位: 天 keep_time: 30 hosts: - name: xxxH3C6800 diff --git a/hosts.yaml b/hosts.yaml index a1b6702..83d09e6 100644 --- a/hosts.yaml +++ b/hosts.yaml @@ -1,4 +1,6 @@ +# 备份文件保存路径 backup_path: '/home/xin053/swConfigBackup' +# 备份文件保存时长, 单位: 天 keep_time: 30 hosts: - name: xxxH3C6800 diff --git a/switchbackup.py b/switchbackup.py index fe72a79..3e97c78 100644 --- a/switchbackup.py +++ b/switchbackup.py @@ -181,7 +181,7 @@ def backup(host): future.result() nowtime = datetime.datetime.now() - +# 删除过期的配置文件 backup_filelist = list(os.listdir(config['backup_path'])) for backup_file in backup_filelist: filetime = datetime.datetime.fromtimestamp(