I apologize ahead of time if this has been answered, but Ive looked through all the other questions and havent found anything that helps.

Here is my upstart script:


start on [2345]
forever start --spinSleepTime 10000 /home/nodeapps/node_app.js
forever start --spinSleepTime 10000 /home/nodeapps/node_metrix.js

When I reboot, I call forever list to see anything running. Nothing shows up. The other answers I have seen suggest looking in /var/log/upstart, but there is no log for nodeapps.

I have tried start on startup, and start on [2345]

Am I missing something obvious? I created the file in /etc/init/, using nano.

Edit: I should note, this is Ubuntu 14 through a VPS, I only have console access, no gui.

2 Answers 2


Try this upstart script:


start on runlevel [2345]

exec start-stop-daemon --start --exec /usr/bin/forever -- start --spinSleepTime 10000 /home/nodeapps/node_app.js

exec start-stop-daemon --start --exec /usr/bin/forever -- start --spinSleepTime 10000 /home/nodeapps/node_metrix.js


Basically forever is not a keyword for an upstart script and upstart doesn't know what to do with it.

exec however is a keyword and it tells upstart which program to start.

UPDATE: Answers

...do you think I could get away with just using /usr/bin/forever ....? Most likely not. The upstart scripts are not a sequence of commands like bash scripts (or .bat / .cmd files in Windows). They are configuration files (like .ini files in Windows) and one of the configuration options happens to point to an actual executable.

...does this explain the fact that theres no logfile being created? Since forever has never been started it didn't have a chance to leave a log file behind. I am reasonably sure you could find something in the upstart log files though.

  • I will try this tomorrow, but it seems like it should work. It didn't cross my mind that forever might not be recognized. Rather than using exec, do you think I could get away with just using /usr/bin/forever ....? Also, does this explain the fact that theres no logfile being created?
    – user281403
    May 14, 2014 at 4:19
  • upstart scripts are not a sequence of commands like bash scripts but you can use it like this askubuntu.com/a/459988/265974 (script tags) then you could work like in a bash script. But to run a daemon smurf answer should be the right way.
    – TuKsn
    May 14, 2014 at 9:36
  • I do not think you can run two exec's like that. You need two jobs. Jun 2, 2014 at 16:48

I know I'm a bit late to this, but rather than using exec and the start-stop-daemon process, use forever's built in daemon, foreverd.

foreverd start --spinSleepTime 10000 /home/nodeapps/node_app.js
foreverd start --spinSleepTime 10000 /home/nodeapps/node_metrix.js

If the root env does not have a path to forever (though it probably does, because you installed it through sudo npm install -g forever) you need to specify the path to foreverd rather than running foreverd. Run

which foreverd

in a terminal that you've logged in to to get the location of foreverd, then run

/path/to/foreverd start --spinSleepTime 10000 /home/nodeapps/node_app.js
/path/to/foreverd start --spinSleepTime 10000 /home/nodeapps/node_metrix.js

This will also automatically create forever log files in ~/.forever/.log

you can figure out what is by running forever list, which will give an output like this:

jbarber$ forever list
info:    Forever processes running
data:        uid  command             script                                              forever pid  logfile                         uptime       
data:    [0] 4Ola /usr/local/bin/node /home/jbarber/projects/project_name/_stage/index.js 7665    7667 /home/jbarber/.forever/4Ola.log 0:0:6:16.714

You can then restart/stop the process using

foreverd restart <process_num>
foreverd stop <process_num>

in this example process num would be 0.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.