Closed joseLourenco closed 8 years ago
I had problems with this yesterday. I tried to do it in the init.d directory but node-supervisor causes huge memory usage issues when run there. You might be able to do an init.d set up more easily in your project.
The following two links I couldn't get to work, but maybe you'll have more success...
For what I think is an ok way, but still seems hacky checkout this link... http://stackoverflow.com/questions/21542304/start-node-js-app-on-boot...
For what I think is the proper way check this out. Not sure if it works on raspbian, but works on other nix distributions... https://github.com/chovy/node-startup
For now we had to hack it with crontab. Would love to figure out the proper way. Additionally we had to delay it to run to work. I believe it's because Bluetooth isn't activated when crontab reboots are done initially. This is how we did it.
sudo crontab -e
@reboot sleep 10 && cd /project-directory && sudo /path-to-node/node app.js > app.logs
Let me know if that works. Again it's a temporary hack until we figure out the proper way.
PS: Please let me know if you manage to get supervisor running with an init.d setup without blowing up your pi. Many thanks!
edited: for clarity and to give better advice...
On 24 Mar 2016, at 02:25, joseLourenco notifications@github.com<mailto:notifications@github.com> wrote:
Hi,
How can I put my node.js app, with node_sensortag, running after the boot?
Thanks
� You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHubhttps://github.com/sandeepmistry/node-sensortag/issues/71
Hi,
First of all, thanks for your reply.
This "@reboot sleep 10 && cd /project-directory && sudo /path-to-node/node app.js > app.logs" is a command line right?
My project directory is /home/pi/poRsCHE. But the "path-to-node" what is it? Is like "usr/bin/node"? How do I know the right address?
No you put the @reboot in the crontab config file. 'which node' to find the path
Again I want to re-emphasize this is a hack imo and to try to do it in the init.d directory instead of crontab. See above links for more info.
Also if anyone watching this repo wants to work with me to develop a better solution I'm all ears.
On Mar 24, 2016, at 11:25 AM, joseLourenco notifications@github.com<mailto:notifications@github.com> wrote:
Hi,
First of all, thanks for your reply.
This "@reboothttps://github.com/reboot sleep 10 && cd /project-directory && sudo /path-to-node/node app.js > app.logs" is a command line right?
My project directory is /home/pi/poRsCHE. But the "path-to-node" what is it? Is like "usr/bin/node"? How do I know the right address?
� You are receiving this because you commented. Reply to this email directly or view it on GitHubhttps://github.com/sandeepmistry/node-sensortag/issues/71#issuecomment-200776232
Ok, thanks.
I'm going to test and I'll report you.
It worked and it didn't work...
In my app I have a bleno service to receive data from my Android app and I have node-sensortag to receive data from the SensorTag. After I boot the Raspberry, it advertises the bleno service but after it receives the data from the Android app, it doesn't connect with the SensorTag.
Do you have som explanation for this? :S
I have no idea. We only use this module for bluetooth communication to the sensortag. We have no communication directly to mobile devices with bluetooth.
The bleno modules was developed by the same author of the node-sensortag, Sandeep Mistry.
My app works well when I execute it by command line. It's just not working well by boot (by your guide).
I'll try other guides. Meanwhile if you have some new idea, I'm here.
Thanks for your support.
Yeah there is something going on behind the scenes on boot up. I'd be very interested to know a way to make this solution portable.
Sent from my iPhone
On 24 Mar 2016, at 13:45, joseLourenco notifications@github.com<mailto:notifications@github.com> wrote:
The bleno modules was developed by the same author of the node-sensortag, Sandeep Mistry.
My app works well when I execute it by command line. It's just not working well by boot (by your guide).
I'll try other guides. Meanwhile if you have some new idea, I'm here.
Thanks for your support.
� You are receiving this because you commented. Reply to this email directly or view it on GitHubhttps://github.com/sandeepmistry/node-sensortag/issues/71#issuecomment-200815175
Hi
I have success with the crontab file but with a line of code a bit different: @reboot sleep 10 && su pi -c 'sudo node-path/node /home/pi/appDirectory/app.js < /dev/null &'
I hope it will help you.
Best regards
The last part from what I sent you writes to a log file. Not sure what your code is doing.
Sent from my iPhone
On 25 Mar 2016, at 12:57, joseLourenco notifications@github.com<mailto:notifications@github.com> wrote:
Hi
I have success with the crontab file but with a line of code a bit different: @reboothttps://github.com/reboot sleep 10 && su pi -c 'sudo node-path/node /home/pi/appDirectory/app.js < /dev/null &'
I hope it will help you.
Best regards
� You are receiving this because you commented. Reply to this email directly or view it on GitHubhttps://github.com/sandeepmistry/node-sensortag/issues/71#issuecomment-201249600
the problems was not your line of code with logs.
was my js app that had a process.stdout that was killing the connection with the sensortag.
@joseLourenco I'm closing this now, as it looks like you question is solved.
In the future, please only create issues for node-sensortag related items, there are much better places to ask general questions related to Linux and Node.js.
@danielbh thank you for helping out!
Hi,
How can I put my node.js app, with node_sensortag, running after the boot?
Thanks