0

I can ssh to a RPi 4 from Windows 10 and start a remote Python script, but the output of the script appears on the Windows console.

Tried using nohup to be able to close the Windows console without interrupting the script, but didn't work (no warnings).

(AHK) run %ComSpec% /c ssh <host> "nohup python3 /home/pi/this.py"

Tried tmux, but using a Windows AHK script to open a ssh connection then create a tmux session gives a warning that tmux file or directory wasn't found (/usr/bin/tmux, same directory as /usr/bin/python).

I can manually connect via ssh and execute tmux without issues.

2
  • You listed a lot of things that you tried... what are you actually trying/hoping to do?
    – JJohnston2
    Jan 8 at 21:27
  • I'd like to execute a remote script via ssh so it opens a console on the remote RPi (tmux) and runs independently of the OpenSSH window on the local Windows machine. Last time I tried tmux in a ssh command, it wasn't found, but it is in the same folder as python3 (/usr/bin).
    – stocky
    Jan 9 at 19:58

1 Answer 1

0

Screen should be able to do what you want (if I properly understand your goal).

You can start it in detached mode via screen -d -m yourcommand (taken from this answer).

I've used this to automatically start a Minecraft server in a way that let me access the console if I needed to admin anything.

6
  • Have you used it within a ssh command/connection?
    – stocky
    Jan 12 at 0:45
  • Not interactively, typing one command at a time, but from a local script (one line).
    – stocky
    Jan 12 at 1:28
  • @stocky yes, I have used it over SSH. I had a headless server at home which I would just SSH to and run minecraft.sh, which would check for a running MC process, and if none were found, it would launch one in a detached Screen. I could then exit that SSH session, and return to the detached Screen in later SSH sessions.
    – JediWombat
    Jan 14 at 4:20
  • This is what I'm talking about: stackoverflow.com/questions/63399902/…
    – stocky
    Jan 15 at 12:22
  • That should work fine, but I'm not in a position to test it. Have you tried it and found it to not work? If so, what is the error or problem you're seeing? The thread to which you've linked has a fairly good answer.
    – JediWombat
    Jan 17 at 22:36

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.