dwebber
dwebber

Reputation: 57

Node JS on Boot

I am running a raspberry pi B+ with the intentions of running a node js app on boot.

I am using the command su pi -c 'node /home/pi/bartender_main/app.js < /dev/null &' in my /etc/rc.local file. When it boots up it act like it work and give me my indication that it is ready, but shortly is says board closing and it quits the app. Does anyone have any ideas. Thanks

Upvotes: 2

Views: 326

Answers (1)

Phssthpok
Phssthpok

Reputation: 1659

The Board Closing message is printed when the Johnny-Five repl reaches the end of its standard input or its process receives a SIGINT.

Directing /dev/null to stdin causes that end of input, so this is likely what is happening. (Also, init scripts are more likely to be killed by SIGTERM or SIGHUP.) Without seeing the internals of app.js, it is hard to say what it is trying to do, but it is probably something like this. You could keep it alive past the initial launch by not ending stdin:

su pi -c 'node /home/pi/bartender_main/app.js'

Upvotes: 1

Related Questions