Script via SSH Hang forever [duplicate]

Try ssh -t hostname python_script. By default, ssh doesn't allocate a pseudo-tty to interact with when it's given a program to run (although it does if you just do ssh hostname); -t tells it to do so.


ssh -t is a good suggestion.

You might also try sprinkling print statements/functions in your code, writing to some file in /var/tmp or whatever, to see what it's doing.

Another way of seeing what a process is doing is to use something like Linux' strace: http://stromberg.dnsalias.org/~strombrg/debugging-with-syscall-tracers.html

EG: ssh remote.host.com 'strace -f -o /var/tmp/my_script.strace my_script'. Then inspect /var/tmp/my_script.strace to see what it's stuck on. Reading strace output isn't always simple, but at least it's interesting. :)