4

I want to run multiple background processes through ssh, aggregate all outputs and errors to the same file and redirect the logs to papertrail using remote_syslog

Following this answer i execute a ruby script in background like this :

ssh deploy@xx.xx.xxx.xx 'cd path/to/my_app; nohup ruby my_script.rb > log/script.log 2> log/script.log < /dev/null &'

It works as long as i only run one script. If i run multiple scripts i only see the output of the first script in the log file.

Can you explain what i'm doing wrong ? Or provide a better way to achieve this. Thanks !

(the log file is in path/to/my_app/log/script.log)


Solution :

Thanks to devnull comment i solved it, it was so simple... The proper command is :

ssh deploy@xx.xx.xxx.xx 'cd path/to/my_app; nohup ruby my_script.rb >> log/script.log 2>> log/script.log < /dev/null &'
Community
  • 1
  • 1
vdaubry
  • 11,369
  • 7
  • 54
  • 76

0 Answers0