代码拉取完成,页面将自动刷新
交换机配置备份及变更检测
python版本支持3.x
使用telent,ssh方式读取交换机配置,telent采用telnetlib方式,ssh采用paramiko方式,对于more处理,暂时采用字符串匹配,不考虑正则。
保存文件分本地和OSS模式,对比采用difflib库
发送邮件使用smtplib库,支持最常使用的QQ邮箱和Yandex邮箱
读取曾考虑netmiko库,但是简化程度太少
mkdir -p /data/app/
cd /data/app
git clone https://gitee.com/gsls200808/Switch-Configuration-Backup-and-Change-Detection.git
mv Switch-Configuration-Backup-and-Change-Detection switchConfig
cd switchConfig
# 安装依赖
pip3 install -r requirements.txt
# 第二种方式安装依赖
pip3 install paramiko
pip3 install oss2
python3 mainRun.py
chmod +x mainRun.sh
./mainRun.sh
crontab -e
i进入编辑模式,输入如下内容
30 8 * * * /data/app/switchConfig/mainRun.sh
:wq回车保存
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。