I am new to node.js so in an attempt to learn it I tried to run this example http://markshust.com/2013/11/07/creating-nodejs-server-client-socket-io-mysql
It has no problems and everything is working fine. But then I wanted to run this server through forever and upstart, and a strange problem occured. When I first reboot the system, upstart runs the server fine, but the server script doesn't list mysql entries. But when I kill the server and forever starts it up again, everything works fine. Could you help me with this? Here is my upstart conf.
#!upstart
description "Forever and Node.js"
start on (starting mysql)
stop on shutdown
expect fork
env NODE_BIN_DIR="***"
env NODE_PATH="***"
env APPLICATION_DIRECTORY="***"
env APPLICATION_START="***"
env LOG="***"
script
PATH=$NODE_BIN_DIR:$PATH
exec forever --sourceDir $APPLICATION_DIRECTORY -a -l $LOG --minUptime 5000 -- spinSleepTime 2000 start $APPLICATION_START
end script
pre-stop script
PATH=$NODE_BIN_DIR:$PATH
exec forever stop $APPLICATION_START >> $LOG
end script