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
  • 6,014
  • 6
  • 39
  • 59

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
  • 10
Mustafa DOGRU
  • 3,994
  • 1
  • 16
  • 24