Why is forever not working to keep my nodejs process running after I logout?

I set up an Ubuntu Server in my home for the purpose of hosting a web application served by nodejs. I have a connect app on my server. When I ssh in and just do something like

node app.js &> server.log &
logout

Then after I logout the server is like put on hold, and it will not serve any requests, but when I ssh back in it starts to serve requests again.

So it looks like the forever package is designed to solve this problem. So installed forever and am doing this:

forever start -al forever.log -ao serverout.log -ae servererror.log app.js

I get the same results from this command. My server will serve requests while I'm ssh'ed in, but once I logout my server stops serving requests. What else can I do to troubleshoot this?

Consider using cron. You can run crontab in bash with no options to get the cron configuration for your account. You may need root access, and then have to specify the user account using the -u option. See man crontab for more information about your distribution's implementation.

I'm sure there are better out there, but this is a decent tutorial on cron's grammar.

I wouldn't use Forever for this but production-ready tools like Supervisord with Monit, see Running and managing nodejs applications on single server.

For each of your application just create a Supervisor configuration file like this:

[program:myapp]
command=node myapp.js                   ; the program (relative uses PATH, can take args)
directory=/www/app/                     ; directory to cwd to before exec (def no cwd)
process_name=myapp                      ; process_name expr (default %(program_name)s)
autorestart=true                        ; whether/when to restart (default: unexpected)
startsecs=1                             ; number of secs prog must stay running (def. 1)
stopwaitsecs=10                         ; max num secs to wait b4 SIGKILL (default 10)
stdout_logfile=/var/log/myapp.log       ; stdout log path, NONE for none default AUTO
stderr_logfile=/var/log/myapp.err.log   ; stderr log path, NONE for none default AUTO

More informations: NodeJS process management at Brin.gr.