autumnrd

Uplink mysql tonel

Jul 10th, 2014
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. # http://scratch-tales.blogspot.ru/
  2. #!/usr/local/bin/python2.7
  3. import subprocess
  4.  
  5. #---------VAR------------
  6. ps_out = []
  7. check_result = 0
  8. #-----------------------
  9.  
  10. check_tonel = subprocess.Popen('ps -ax | grep ssh', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
  11. retval = check_tonel.wait()
  12.  
  13. for line in check_tonel.stdout.readlines():
  14.     if line.find('ssh -fNg -L 3310:127.0.0.1:3306 [email protected] -p371') != -1:
  15.     check_result = 1
  16.  
  17. if check_result == 0:
  18.     tonel_revive = subprocess.Popen('/usr/bin/ssh -fNg -L 3310:127.0.0.1:3306 [email protected] -p371', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
  19.     retval = tonel_revive.wait()
Advertisement
Add Comment
Please, Sign In to add comment