I am trying to have a nodejs application start automatically on system boot. Basically all I need is to run the command node /dir/app
.
I am using openwrt on an Arduino Yun. And have tried a couple things.
On the openwrt website it said I can do this. https://wiki.openwrt.org/inbox/procd-init-scripts :
#!/bin/sh /etc/rc.common
USE_PROCD=1
start_service() {
procd_open_instance
procd_set_param command node ///www/www-blink.js
procd_close_instance
}
I have also tried changing the dir to /www/www-blink.js
not ///
However i'm not sure what i'm doing wrong as nothing comes up when I try run it with /etc/init.d/node-app start
I am obviously writing the code wrong but i'm not sure what it should exactly look like.
The other thing I have tried is the node modules forever
and forever-service
.
I downloaded them on my computer using npm install -g forever
and forever-service aswell. I transfered them to usr/lib/node_modules on my arduino yun. However when I try to use and forever(-service) commands it says
-ash: forever: not found
I have tried a couple other things, however nothing has worked. Any help would be greatly appreciated.
-- I also need to be able to start my express script with npm start
not node app
but I guess the first thing is getting it to work at all.