Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1044287
  • 博文数量: 239
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 3618
  • 用 户 组: 普通用户
  • 注册时间: 2012-11-12 13:17
文章分类

全部博文(239)

文章存档

2021年(1)

2016年(1)

2015年(30)

2014年(91)

2013年(116)

分类: LINUX

2014-02-18 23:43:49


[root@oracle11g home]# cat pysysinfo.py 

点击(此处)折叠或打开

  1. #!/usr/bin/env python
  2. #A System Information Gathering Script
  3. import subprocess

  4. #Command 1
  5. uname = "uname"
  6. uname_arg = "-a"
  7. print "Gathering system information with %s command:\n" %uname
  8. subprocess.call([uname,uname_arg])

  9. #Command 2
  10. diskspace = "df"
  11. diskspace_arg = "-h"
  12. print "Gathering diskspace information %s command:\n" %diskspace
  13. subprocess.call([diskspace,diskspace_arg])
[root@oracle11g home]# ./pysysinfo.py 
Gathering system information with uname command:


Linux oracle11g 2.6.32-279.el6.x86_64 #1 SMP Wed Jun 13 18:24:36 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
Gathering diskspace information df command:


文件系统      容量  已用  可用 已用%% 挂载点
/dev/mapper/VolGroup-lv_root
                       50G   11G   37G  22% /
tmpfs                 1.9G  100K  1.9G   1% /dev/shm
/dev/sda1             485M   37M  423M   8% /boot
/dev/mapper/VolGroup-lv_home
                      5.6G  140M  5.2G   3% /home
df: "/mnt/hgfs": 输入/输出错误
阅读(1221) | 评论(0) | 转发(0) |
0

上一篇:Python封装linux命令

下一篇:Python函数封装

给主人留下些什么吧!~~