0

I have a .sh file and related Python files associated with the script on my local machine, but I need to run it using screen because I need an ssh connection for a long period of time. So I need to ssh into a remote machine and continue to run the .sh script until it finishes. I've been looking throughout StackExchange for information on how to do this, but I'm confused on how to proceed.

Do I need to copy the files onto the remote machine to do this? If not, what is the command I would need to run using screen to accomplish this task? Thanks.

So far I've tried:

1) ssh name@server screen -d -m "./executable.sh"
2) ssh -t name@server "screen -RD && ./executable.sh"

Let me know if I'm doing something wrong here.

  • How did you copy the files to the other machine? Have you tried to ssh into the other machine first, then start screen, then start the program and disconnect ssh. Make sure things work before optimizing into one-liners. – Anthon Jul 18 '17 at 4:09
1

If your python scripts should be executed on the remote machine, there is no way around it. You gotta copy everything.

You may modify your .sh to copy those files using scp, then open ssh session, execute python scripts, and finally exit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.