1

I'm trying to run a bash script on a remote machine, and I'd like to return immediately after running the script in the background of the remote machine. For instance:

$ echo foo.txt
sleep 2000 &

then when I tried to do:

$ ssh x.x.x.x 'bash -s' < foo.txt

the command never returns. Is there a way to make it return while sleep runs in the background on the remote machine?

JRR
  • 5,694
  • 5
  • 35
  • 57

1 Answers1

1

May by;

echo foo.txt
sleep 2000 >&- 2>&- <&- &
  • >&- means close stdout.
  • 2>&- means close stderr.
  • <&- means close stdin.
  • & means run in the background
sozkul
  • 665
  • 4
  • 8
Mustafa DOGRU
  • 3,814
  • 1
  • 12
  • 20