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

全部博文(239)

文章存档

2021年(1)

2016年(1)

2015年(30)

2014年(91)

2013年(116)

分类: LINUX

2014-02-18 23:56:24

[root@oracle11g home]# cat pysysinfo_func.py 

点击(此处)折叠或打开

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

  4. #Command 1
  5. def uname_func():

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

  10. #Command 2
  11. def disk_func():

  12.     diskspace = "df"
  13.     diskspace_arg = "-h"
  14.     print "Gathering diskspace information %s command:\n" %diskspace
  15.     subprocess.call([diskspace,diskspace_arg])

  16. def main():
  17.     uname_func()
  18.     disk_func()

  19. main()


[root@oracle11g home]# ./pysysinfo_func.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": 输入/输出错误
阅读(1233) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~