3 Replies Latest reply on May 2, 2017 11:01 AM by Intel Corporation

    How can I make a nodejs script to auto run when Galileo starts up?

    juanfdonoso

      Hi everybody,

       

      I wrote a nodejs script  for Galileo that launches a webserver and also reads the Grove temperature sensor.  The script works pretty well.  Now I want that script to run automatically when Galileo starts up.

       

      The script is located at /home/root/ejemplos_node/temperature.js

       

      To make the script to run when Galileo boots, I wrote the following bash script in the init.d folder (the script is called mystartup.sh):

       

      #! /bin/sh

      node /home/root/ejemplos_node/temperatura.js

      chmod +x /etc/init.d/mystartup.sh

      ./mystartup.sh

       

      Then I executed the following commands on the console  to change the permissions to make the bash script executable:

       

      root@galileo:/etc/init.d# chmod +x /etc/init.d/mystartup.sh

      root@galileo:/etc/init.d# chmod +x mystartup.sh

       

      To check if the bash script is working, I executed:

       

      root@galileo:/etc/init.d# ./mystartup.sh

       

      and the script runs pretty well.  That made me think that I had everything ready. However, if I reboot the Galileo, nothing happens.  The script doesn't run and I don't know how to solve it.

       

      Any help is welcome.

       

      Regards,


      Juan