Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. import paramiko
  2. import sys
  3. import time
  4. def send_string_and_wait(command, wait_time, should_print):
  5. shell.send(command)
  6. time.sleep(wait_time)
  7. receive_buffer = shell.recv(1024)
  8. if should_print:
  9. return receive_buffer
  10.  
  11. dbname='test'
  12. cl='testdb'
  13. host='testhost'
  14. owner='maknoorn'
  15. passwd='p'
  16.  
  17.  
  18. client = paramiko.SSHClient()
  19. client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  20. client.connect(str(host), username=str(owner), password=str(passwd), port=22)
  21. shell = client.invoke_shell()
  22. send_string_and_wait("sudo su - oraclen", 1, True)
  23. send_string_and_wait(str(passwd) + "n", 1, True)
  24. a=send_string_and_wait("sh /orashare/ettool/Validation_Final.sh" + str(' ') + str(dbname) + str(' ') + str(cl) + "n", 0, True)
  25. print a
  26. client.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement