2

I'm trying to start nodeJs server on my app automaticaly when the server boot the system.I"m on ubuntu server 12.4

I installed the forever packet,

sudo npm -g install forever

now I created a file on /etc/init/server_node.conf and edited this with this:

#/etc/init/server_node.conf
description "My Demo Node App"
author "Me"

start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown

script
    cd /var/www/kwiki/assets/node/
    exec /var/www/kwiki/assets/node/ node app.js 2>&1 >> /var/log/server_node.log
end script

When I restart the ubuntu server,nodeJs does not start automaticaly.PLease where is the problem.I mistake someting in the process?

I also used this script in server_node.conf

start on startup
exec forever start /var/www/kwiki/assets/node/test.js

No change,NodeJS dont start automaticall after reboot server.I'm newbie

I wish your help please.tank's

yanstv
  • 157
  • 1
  • 14
  • 1
    Do you mean to have a space between the directory and `node` in ` exec /var/www/kwiki/assets/node/ node app.js 2>&1 >> /var/log/server_node.log`? – Joe May 02 '14 at 18:08
  • yes @Joe with this space – yanstv May 03 '14 at 19:14
  • then I think that's wrong -- if you take that exec line and paste it does it work? It doesn't look like it will to me. – Joe May 03 '14 at 19:51
  • After some research the command: exec forever start /var/www/kwiki/assets/node/test.js works fine when I put this in file.sh in the right directory.My problem is resolved.thank @joe for your reaction. – yanstv May 05 '14 at 08:53

0 Answers0