Quantcast
Channel: Admins Goodies » stderr
Viewing all articles
Browse latest Browse all 10

start sinatra app in background with stdout and stderr redirected(append) to a file

$
0
0

Question

I have a sinatra app which I run on my local machine using ruby app.rb.

While deploying it on a remote machine via ssh, How do i run it in background and redirect stdout and stderr to a log file. On a restart, I want to preserve the previous logs so that newer messages are appended to the existing log file, instead of truncating it.

What’s the recommended way of running my webapp as a daemon ?

I’ve tried nohup ruby app.rb & , but that seems to be missing stderr and the log statements seem to be out of order in some cases.

Answer

Under bash, try:

ruby app.rb >> /log/file 2>&1 &

Viewing all articles
Browse latest Browse all 10

Trending Articles