[root@oracle11g home]#
cat pysysinfo_func_2.py
-
#!/usr/bin/env python
-
#A System Information Gathering Script
-
import subprocess
-
-
#Command 1
-
def uname_func():
-
-
uname = "uname"
-
uname_arg = "-a"
-
print "Gathering system information with %s command:\n" %uname
-
subprocess.call([uname,uname_arg])
-
-
#Command 2
-
def disk_func():
-
-
diskspace = "df"
-
diskspace_arg = "-h"
-
print "Gathering diskspace information %s command:\n" %diskspace
-
subprocess.call([diskspace,diskspace_arg])
-
-
def main():
-
uname_func()
-
disk_func()
-
if __name__ == "__main__":
-
main()
[root@oracle11g home]#
./*2.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": 输入/输出错误
>>>
import pysysinfo_func_2
调用模块时就不会被显示。
阅读(1102) | 评论(0) | 转发(0) |