3

This is my upstart file /etc/init/myapp.conf on my Ubuntu 12.04.

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.

lwood
  • 265
  • 1
  • 5
  • 10

1 Answers1

0

Can you output anything? Output your environment, and specifically your path variable and see if they are different from when you can start it, to when it fails.

When it fails, is there an output file and what is the error?

My guess is that the path is not yet fully set up.

dansch
  • 6,059
  • 4
  • 43
  • 59