Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
1,078 Views

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

Jump to solution

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
Tags (1)
0 Kudos

Accepted Solutions
Highlighted
Community Manager
9 Views

Hi Juan,

 

 

Thanks for contacting us!

 

 

I appreciate all the information provided. I'd suggest you to create a system service in order to enable your script to run every time the Galileo boots. Please take a look at this thread for more details about how to create it: /message/461019# 461019 https://communities.intel.com/message/461019# 461019.

 

 

Hope you find this information useful.

 

 

Regards,

 

-Yermi A.

 

View solution in original post

0 Kudos
3 Replies
Highlighted
Community Manager
10 Views

Hi Juan,

 

 

Thanks for contacting us!

 

 

I appreciate all the information provided. I'd suggest you to create a system service in order to enable your script to run every time the Galileo boots. Please take a look at this thread for more details about how to create it: /message/461019# 461019 https://communities.intel.com/message/461019# 461019.

 

 

Hope you find this information useful.

 

 

Regards,

 

-Yermi A.

 

View solution in original post

0 Kudos
Highlighted
Beginner
9 Views

Hi Yermi,

Thank you so much. Now it is working!!!

Just a little comment: I created the system service in:

/etc/systemd/system

Best regards,

Juan

0 Kudos
Highlighted
Community Manager
9 Views

Hi Juan,

 

 

Thanks for confirming it works, I'm glad to help you.

 

 

Have a nice day!

 

 

Regards,

 

-Yermi A.

 

0 Kudos