Community
cancel
Showing results for 
Search instead for 
Did you mean: 
idata
Community Manager
1,834 Views

Shutting down Intel Edison from code

Hello,

I am trying to write code for my intel edison that after a certain time of not receiving any data from a sensor, the edison shuts off completely. I do know that linux has the "shutdown now" code if I am in command line but I can't seem to figure out past that.

I am using Intel XDK.

Thanks for any help!

0 Kudos
6 Replies
ABans
Novice
65 Views

You can use the command

sudo systemctl poweroff

Don't need to use sudo if running as a root. You can also specify reboot instead of poweroff

idata
Community Manager
65 Views

What is the right syntax to use a linux command from within a sketch that is in intel xdk (node.js)?

idata
Community Manager
65 Views

Hello nahko,

 

 

If you are using Node.js, the best way to use a system command (like poweroff, which is used to shut down the board) is to use Child Process. I suggest you to read Node's manual section for Child Process, there you should be able to get more information about how to achieve this.

 

 

Let me know if this information helps you.

 

-Peter.
idata
Community Manager
65 Views

Hi nahko,

 

 

I was wondering how you were doing, do you have any updates?

 

 

-Peter.
idata
Community Manager
65 Views

Hey Peter,

I did end up getting the Intel Edison through using a Child Process.

Thanks for the help!

idata
Community Manager
65 Views

Hi noahko,

 

 

That's great to hear, I'm glad it's working. If you ever have any other doubts, please don't hesitate to come back to the community.

 

 

-Peter.
Reply