From: Gennady Date: 2004-02-03T10:11:15+09:00 Subject: Re: shell scripts in background (with &) - why would they stop? Ruby Baby wrote: > Shouldn't a Ruby script keep running if someone uses the "&" at the end of the command? > > I have a script that takes hours to run, processing many files, on a remote server. > > If I start it like this... > ./processFiles.rb > ... it will work, but I have to keep an SSH terminal window open for hours. > > If I start it like this... > ./processFiles.rb & > ... and then I close my SSH session to let it run > ... it stops immediately after I log out. try: trap '' 1 ./processFiles.rb >processFiles.log 2>&1 & or with 'nohup', which will do the same for you (redirecting to nohup.out, though): nohup ./processFiles.rb & > > > Is that expected behavior? > > How would I get it to keep running (like my regular /bin/sh shell scripts) after I log out? > > I could give example code if someone wants to see it. >