description "Upstart script"
start on filesystem and started networking
FYI: não use "iniciar na inicialização" .
stop on shutdown
expect fork
# Let's make sure we always have the right directory
chdir /var/www/myapp
env MYAPP_PATH="/var/www/myapp"
env NODE_ENV=production
env PORT=3001
# Is there a reason you didn't do this?
env APP_PATH=$MYAPP_PATH
script
# Shell trick to re-direct this script's STDOUT/STDERR
exec 2>> forever.log 1>> forever.log
# You forgot the 'start' command. Without it, it doesn't fork.
exec forever start -a -l forever.log -o out.log -e err.log app.js
end script
pre-stop script
# Shell trick to re-direct this script's STDOUT/STDERR
exec 2>> forever.log 1>> forever.log
exec forever stop app.js
end script