Okay, there are a few similar topics to this one, but what I want to do is run a program in a screen session on a remote computer.
Taking my lead from this thread
In the hope that it is correct, I am entering the command:
ssh [email protected] "screen -S test -d -m roslaunch startup startup_node"
which neither starts a new screen session "test" or runs my script "roslaunch startup startup_node"
I can create a remote session "test":
ssh [email protected] "screen -S test -d -m"
But how can I then run a command in it? How is the screen -X
command used with a named screen?
I have tried, based on this :
ssh [email protected] "screen -X stuff "roslaunch startup startup_node^M" "
but again it doesn't seem to start the process remotely. Both commands work if you are already ssh'd into the remote.
I've also tried to write a script startnav.sh on my remote machine that contains screen -S nav -d -m roslaunch startup startup_node
and I run it by:
ssh [email protected] -t "./startnav.sh"
This creates the screen instance however it is dead as in the following output
~$ ssh [email protected] -t screen -r nav
There is a screen on:
4506.nav (04/06/15 12:30:09) (Dead ???)
Remove dead screens with 'screen -wipe'.
There is no screen to be resumed matching nav.
Connection to 192.168.1.5 closed.
Finally, I've followed the question here
and can get normal bash commands to execute, just not 'roslaunch startup startup_node'
for instance
ssh -f [email protected] "screen -dm -S nav htop "
will launch a htop session in a separate screen on a remote machine. The -f
flag seems to be important. But still doesn't work for a roslaunch or a script that contains roslaunch even though it does work if run without ssh. Additionally, for a temporal program such as sleep 10
, the screen will only exist until that script is completed executing.