系统管理任务的简单工具

s的Python项目详细描述


文档:http://sy.afajl.com

来源:http://github.com/afajl/sy

此库是一组易于使用的模块,可帮助实现 系统管理任务:

import sy.path, sy.net.intf, sy.net.ip, sy.cmd

# Replace lines in '/etc/hosts' that match nis.*
sy.path.replace_lines('/etc/hosts', 'nis.*', '10.2.3.1 ldap')
1

# Fetch information about the interface hme0
hme0 = sy.net.intf.get('hme0')

# Get the IP of hme0
hme0.ipaddress
'192.168.2.2'

# Check if hme0 is up
hme0.is_up
True

# Find files named '*.pl' but time out after 10 seconds
out, err = sy.cmd.do('find /mnt -name {}', '*.pl', timeout=10)

# Check if port 22 is answering on bart
if not sy.net.ip.port_is_open('bart', 22):
   sy.log.warning('Ssh is down on bart')

这个库深受Werkzeug的启发,这是一个很棒的wsgi实用程序 收藏。

开发

sy的存储库路径位于 http://github.com/afajl/sy。通过键入git克隆:

$ git clone http://github.com/afajl/sy.git

开发的需求列在dev-reqs.pip中 可使用pip安装,使用:

$ pip install -r dev-reqs.pip

这个库目前的目标是Python2.4.4-2.6。

测试

要运行测试套件,请使用nose

$ nosetests -a '!host' tests

!host参数告诉套件不要运行更改主机的测试 配置(如重新配置网络接口)。

目前还没有任何在虚拟机上运行测试套件的自动化方法。 为了能够测试库的所有部分以及 在不同版本和操作系统上测试。

文件

文档是用sphinx构建的,位于docs文件夹下。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java这种src与构建树时间戳的比较如何更快?   java如何在两个命令处理程序之间通信   java下拉框值更改   Java如何从另一个类中提取字段的值   无字段名的java Jackson序列化   java游戏循环和方法调用   java Spring Security permitAll()匹配器被忽略   java如何在一个方法中将数组中的int作为单独的int传递?   使用ArrayList在Java中实现同步队列   java JButton的操作侦听器在JTable中不工作   java中C++ OOP指针的技巧   java My regex搜索只打印出最后一个匹配项   java如何在Hadoop中序列化非常大的可写对象   spring Paypal JavaSDK支付执行问题   带有SPNEGO SSO的java Tomcat 6仍会提示输入登录名和密码   java HttpResponse主体正在更改   java如何在RxJava中实现链锁   为什么我需要java。lang.ClassNotFoundException:com。mysql。希杰。jdbc。mysqlconnectorjava8时的驱动程序。0.16.jar在类路径中?   java输入错误。即使在接受新输入后仍使用旧输入