Disclaimer: Its a collection from lots of other site(s) and few of my notes. I would also like to declare that I am not owning lots of its content. Please feel free to contact me directly if you want me to remove any of your content, that you don't want to share to other through this blog.
Monday, 10 March 2014
python script with system command 1
NOTE: sudo apt-get install ipython [ To install ipython ]
#!/usr/bin/env python
# System Information Gethering Script
import subprocess
# Example:
# subprocess.call(["ls","-l","/tmp/"])
# Example: You can also use as following for the above command:
# subprocess.call("df -h", shell=True)
#Command 1
uname = "uname"
uname_arg = "-a"
print "Gethering system information with %s command:\n" %uname
subprocess.call([uname,uname_arg])
#Command 2
diskspace = "df"
diskspace_arg = "-h"
print "Gathering diskspace information %s command:\n" %diskspace
subprocess.call([diskspace,diskspace_arg])
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment