File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
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 ()
You can’t perform that action at this time.
0 commit comments