LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Start on boot a Node.js Server (https://www.linuxquestions.org/questions/linux-newbie-8/start-on-boot-a-node-js-server-4175425833/)

exomic 09-05-2012 04:02 PM

Start on boot a Node.js Server
 
exomic wrote:
Hi,

I'm running a Centos 6.3 server and I want to start my Websocket server on startup. For that I need to run a screen session and within the session run the command
Code:

node websocketServer.js
So I tried adding this line at the end of rc.local:

Code:

su websocket -c "screen -S ws -d -m /var/includes/websocket/start.sh"
In start.sh :
Code:

cd /var/includes/websocket; node websocketServer.js;
start.sh is executable

Any help?

PS: The command is working fine in shell as root

Elv13 09-06-2012 03:14 PM

I suggest making an init script instead of using rc.local. Take a look at scripts in /etc/init.d, make your own and add it to the boot process (level 3 and 5). We will go from there.


All times are GMT -5. The time now is 04:43 PM.