0

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!

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
exomic
  • 466
  • 6
  • 16
  • The most reliable way I found to do that is starting the script using the distro GUI's startup list. Even `ifup/ifdown` failed. – Ricardo Tomasi Sep 09 '12 at 01:53

1 Answers1

0

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
exomic
  • 466
  • 6
  • 16