2010-06-18

Using ssh to execute remote commands

I wanted to make a "make run" command to download and run my embedded application on target using ssh. Download with scp is no problem, but then I wanted to execute the program with a command like this.

ssh root@target_ip /tmp/myprogram & 

I experienced that the session would hang. It needed a to terminal the connection. I found that it seems to be the output from the program which makes it hang, so I tried piping the output to /dev/null. Something like this:

ssh root@target_ip /tmp/myprogram 2>/dev/null >/dev/null &

And this did the trick. Make now exits fine.

No comments:

Post a Comment