Advertisement
Guest User

Untitled

a guest
Aug 11th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. import pexpect
  2. import paramiko
  3. import sqlite3
  4. import time
  5.  
  6. def runCommands(*someCommands):
  7.     global testid
  8.     ssh = paramiko.SSHClient()
  9.     ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  10.     ssh.connect('some.server.example.com', username='root', password='abc123')
  11.     for i in someCommands:
  12.         ssh.exec_command(i)
  13.         logCustom('SSH COMMAND SENT', i)
  14.     return
  15.  
  16. runCommands('/etc/init.d/mysqld restart >> mysqld.log 2>&1', \
  17.         '/etc/init.d/httpd restart >> httpd.log 2>&1')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement