Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

script
  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

1 Answer 1

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

 
discard

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.