Detaching Process from “Run Script Over SSH” in Shortcuts

ssh

I'm trying to use the "Run Script Over SSH" in Shortcuts (found under Scripting > Shell.

I want to execute a long running command from a sharesheet. So that the sharesheet doesn't remain open, and I can move on to other tasks without worrying about leaving the network etc, the command, foo, needs to execute detached from the SSH session.

I have tried using nohup, but I receive a nohup: can't detach from console: Undefined error: 0. I have also tried backgrouding & and using disown, but neither technique has been successful. Also tried screen on my machine, but it just hangs blank. Are these ineffective because of security changes to MacOS?

What is the appropriate way to keep foo running after my ssh session is gone?

Best Answer

Try using tmux it'll keep sessions alive after you leave.