Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- multiprocess module with paramiko
- jobs = []
- for obj in appObjs:
- if obj.stop_app:
- p = multiprocessing.Process(target=exec_cmd, args=(obj, obj.stop_cmd))
- jobs.append(p)
- print "Starting job %s" % (p)
- p.start()
- raise AssertionError("PID check failed. RNG must be re-initialized after fork().
- Hint: Try Random.atfork()")
- import ssh
- from multiprocessing import Process
- handle = ssh.SSHClient()
- handle.set_missing_host_key_policy(ssh.AutoAddPolicy())
- handle.connect(hostname, username=user, password=pass)
- def processFunc(param):
- print "child"
- stdin, stdout, stderr = handle.exec_command("ls -l /var/log")
- cmdOutput = ""
- while True:
- try:
- cmdOutput += stdout.next()
- except StopIteration:
- break
- print cmdOutput
- dummy = None
- p = Process(target=processFunc, args=(dummy,))
- p.start()
- p.join()
- print "Parent"
- processFunc(dummy)
- handle.close()
Add Comment
Please, Sign In to add comment