Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c947653

Browse files
authored
Add files via upload
1 parent 847c199 commit c947653

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

systemGather.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/python3
2+
3+
"""
4+
Name: systemGather.py
5+
Author: Ty Lim
6+
Date: July 14, 2016
7+
Description: Simple example on how to use the subprocess module to gather some system info.
8+
9+
Usage:
10+
11+
> ./systemGather.py
12+
13+
"""
14+
import subprocess
15+
16+
17+
def uname_func():
18+
command = "uname"
19+
command_arg = "-a"
20+
print ("System Gathering info with %s command:\n" % command)
21+
subprocess.call([command, command_arg])
22+
23+
def diskspace_func():
24+
diskspace = "df"
25+
diskspace_arg = "-k"
26+
print ("Disk Space info gathering using %s command:\n" % diskspace)
27+
subprocess.call([diskspace, diskspace_arg])
28+
29+
def main():
30+
# Getting 'uname' info
31+
uname_func()
32+
33+
# Getting 'diskspace' info
34+
diskspace_func()
35+
36+
37+
if __name__ == '__main__':
38+
main()

0 commit comments

Comments
 (0)