Skip to content

Instantly share code, notes, and snippets.

@isurum
Last active June 16, 2017 11:57
Show Gist options
  • Save isurum/c40f0949d77325a19c7c61e1db606ff2 to your computer and use it in GitHub Desktop.
Save isurum/c40f0949d77325a19c7c61e1db606ff2 to your computer and use it in GitHub Desktop.
Python system info script using functions
#!/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