Inside the Ruby script, you can redirect stdout and stderr using the IO#reopen .
# a.rb $stdout.reopen("out.txt", "w") $stderr.reopen("err.txt", "w") puts 'normal output' warn 'something to stderr'
$ ls
a.rb
$ ruby a.rb
$ ls
a.rb err.txt out.txt
$ cat err.txt
something to stderr
$ cat out.txt
normal output
Mark Rushakoff Jun 10 '10 at 21:38 2010-06-10 21:38
source share