Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3.4
- import mysql.connector
- import time
- import subprocess
- import getopt
- import sys
- def main():
- try:
- opts, args = getopt.getopt(sys.argv[1:], "ho:l:v", ["help", "outfile=", "load="])
- except getopt.GetoptError as err:
- print (str(err))
- usage()
- sys.exit(2)
- outfile = None
- verbose = False
- for o, a in opts:
- if o == '-v':
- verbose = True
- elif o in ("-h", "--help"):
- usage()
- sys.exit()
- elif o in ("-o", "--outfile"):
- outfile = a
- elif o in ("-l", "--loadlimit"):
- loadlimit = a
- else:
- assert False, "bip boop error with args"
- print(outfile)
- print(loadlimit)
- cnx = mysql.connector.connect(user='root', password='1234', host='localhost')
- cursor = cnx.cursor()
- while True:
- cursor.execute("show full processlist")
- result=cursor.fetchall()
- print(result)
- subprocess.Popen("uptime")
- time.sleep(1);
- cursor.close()
- cnx.close()
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement