How to use django in conjunction with paramikon to return the execution result of a remote machine in real time

ssh = paramiko.SSHClient()
ssh.connect(host, port, username, pkey=key, timeout=2)
stdin, stdout, stderr = ssh.exec_command(shell)
stdin, stdout, stderr = ssh.exec_command(shell)
result = stdout.read(), stderr.read()

where the result result can not be read until all the exec_command has been executed

what if my shell has been executed for two or three minutes, during which time, there is log output? what should I do if I want to get this log in real time?

Jun.06,2021

there is something called the RabbitMQ queue. All the messages in the execution process are push into the queue. The front end listens to the queue and prints out any messages.

attach your blog , sorted out a few days ago, to give you a reference

Menu