0

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.

lwood
  • 65
  • 1
  • 5

1 Answers1

0

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
Matthew Steeples
  • 1,303
  • 1
  • 10
  • 17