I'm trying to do the following from a python script:
So I try the following:
import os
os.system('ssh -t -t myname@server')
os.system('nice -11 screen')
However, the last command does not execute on the server. I get into the server, but have no connection to it from the python script anymore. What I want to do now is create a screen session.
How about this:
import os
os.system('ssh -t -t myname@myserver "nice -11 screen"')
This leaves you at the screen.
Or if you just want to run a few commands:
import os
os.system('ssh -t -t myname@myserver "ls && pwd"')
This runs both these commands, then exits.
Edit:
The following will leave you at a shell prompt:
os.system('ssh -t -t myname@myserver "nice -11 screen -U"')
The following will run a command, then leave you at a shell prompt:
os.system('ssh -t -t myname@myserver "ls > ~/x.txt && nice -11 screen -U"')