Guest User

Untitled

a guest
Mar 2nd, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. import paramiko
  2. import datetime
  3.  
  4. with open('password.txt') as f:
  5. for line in f:
  6. pw = line
  7.  
  8. with open('host.txt') as f:
  9. for line in f:
  10. host = line
  11.  
  12. with open('username.txt') as f:
  13. for line in f:
  14. username = line
  15.  
  16. print("logging into " + username + "@" + host)
  17.  
  18. ssh = paramiko.SSHClient()
  19. ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  20. ssh.connect(host, username=username, password=pw)
  21.  
  22. print ("gathering queue statistic")
  23. print ("executing qstat ...")
  24.  
  25. ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command('qstat -f')
  26.  
  27. current_time = datetime.datetime.now()
  28. new_file = open(str(current_time), 'w')
  29. for line in iter(ssh_stdout.readline, ""):
  30. new_file.write(line)
  31.  
  32. new_file.close()
  33.  
  34. print('finished')
Add Comment
Please, Sign In to add comment