I'm trying to start a screen session on startup, so I added my script at the end of rc.local
screen -S ws sh -x /var/includes/websocket/start.sh;
But that doesn't work. My goal is to be able to run in a screen session (screen named ws) 2 commands:
Start.sh content:
cd /var/includes/websocket
node /var/includes/websocket/websocketServer.js 2>&1 >> /var/log/websocket.log' websocket
I also tried creating a cronjob but still unable to start the script.
Any help welcomed!
I found a way around it! Seems that "node" is not recognized by rc.local so I simply had to use the full directory in the command:
Instead of
node /var/includes/websocket/websocketServer.js
Use
/usr/local/bin/node /var/includes/websocket/websocketServer.js