Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is my upstart file /etc/init/myapp.conf:

description "Example of starting Node with Upstart and Forever"

start on filesystem or runlevel [2345]
stop on runlevel [06]

expect fork

console output

setuid lwood

env HOME=/home/lwood

  cd $HOME
  exec forever -a -l /home/lwood/myapp/applog.log \
       start /home/lwood/myapp/app.js
end script

pre-stop script
  cd $HOME
  exec forever stop /home/lwood/myapp/app.js
end script

Do you know why $ sudo restart myapp is only stopping the service? It does not start the service after stopping it. So it has the same effect as $ sudo stop myapp.

Doing $ sudo stop myapp and then $ sudo start myapp works fine though. Wondering why restarting behaves different.

I'm on Ubuntu 12.04.

share|improve this question

I would guess it's something to do with the output of the script causing the upstart script to stop.

If you follow the guide on this page they seem to recommend piping the stdout to a log file.

env LOG="/var/log/my-application.log"
exec forever stop /home/lwood/myapp/app.js >> $LOG
share|improve this answer
Thanks for the reply. I tried this but it didn't work. Do you have any other ideas? – lwood Oct 23 '13 at 14:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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