比较本地脚本输出和远程脚本输出
compare-with-remote的Python项目详细描述
与远程比较
比较本地文件和远程文件
关于
这是一个通用的文件比较工具。我写这封信是为了帮助从“宠物到牛”的过渡。换言之 我将从使用vi和ssh管理的linux服务器切换到配置管理。
它帮助您将远程主机上的文件与本地文件系统上的文件进行比较。
安装
pip install -e git+https://github.com/guettli/compare-with-remote.git#egg=compare-with-remote
用法
===> compare-with-remote -h usage: compare-with-remote [-h][--only-files-containing-pattern ONLY_FILES_CONTAINING_PATTERN] directory_url_one directory_url_two compare two directories. Directories can get fetched via ssh first, then"meld" get called to copmare the directories. See https://github.com/guettli /compare-with-remote positional arguments: directory_url_one [[user@]remote-host:]dir directory_url_two [[user@]remote-host:]dir optional arguments: -h, --help show this help message and exit --only-files-containing-pattern ONLY_FILES_CONTAINING_PATTERN
示例
您想比较/etc目录中包含单词“rsyslog”的所有文件:
root@local-server> compare-with-remote --only-files-containing-pattern rsyslog \ root@server-with-cute-name-1:/etc \ root@server-with-cute-name-2:/etc
您可以比较如下脚本的输出:
root@local-server> compare-with-remote \ 'postgres@server-with-cute-name-1:psql -c "select app, name from django_migrations order by id"'\ 'postgres@server-with-cute-name-2:'
如果没有为第二个主机提供远程命令,则将调用第一个主机的命令在这种情况下 比较数据库表的所有行
屏幕截图
获取文件后,脚本调用工具“meld”以显示实际的差异:
下面是meld的屏幕截图,显示了两个文件之间的区别:
不要害羞
我想知道你的想法和感受。请通过github问题跟踪器发表评论。我喜欢反馈。