0

The idea is to connect to a remote machine via ssh and execute a shell script without waiting for it to finish.

EDIT: The issue was ssh, not nohup.

James
  • 1

1 Answers1

0

This works for me:

ssh myhost 'nohup /home/me/myscript > /dev/null 2>&1 < /dev/null &'

Notice the redirections and in-direction. In my case, myscript takes no input and I don't care about the output so I'm using /dev/null for everything. You can adjust these values as you see fit. The < /dev/null is used to avoid waiting on input.

I wish I could take credit, but I saw this answer here: https://stackoverflow.com/questions/29142/getting-ssh-to-execute-a-command-in-the-background-on-target-machine

Visit that link for more details about exactly what's happening.

mikem
  • 526