How can I make Forever run Node.js script on startup?

forever, node.js, startupscript

Solution

Edit crontab:

   $ sudo crontab -e

The first time it will ask you which editor you wish to edit with.

Once in the editor add the following line:

   @reboot /usr/local/bin/forever start /your/path/to/your/app.js

Save the file.

Reboot.

Problem

I am running forever for my node.js which is great, but when the server restarts I have to rerun the command. Are there any suggestions on how to make it so on reboot or start up, forever automatically launches the script. Lets say its forever /var/www/server.js Thank you!

Original source