Last active
June 16, 2017 11:57
-
-
Save isurum/c40f0949d77325a19c7c61e1db606ff2 to your computer and use it in GitHub Desktop.
Python system info script using functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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]) | |
#Main function that call other functions | |
def main(): | |
uname_func() | |
disk_func() | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment