Community
cancel
Showing results for 
Search instead for 
Did you mean: 
RModi1
Novice
1,642 Views

How to reboot Galileo Gen2 from java

Hi There,

While working on an IoT application I found a java code which reboot Arduino Uno. But I want to reboot Galileo Gen 2 board from java.

Is there any class or method written which I can utilize in my application to reboot Galileo.

Please find attached java file and refer "reboot()" method which reboots Arduino Uno.

Regards

Rahul Modi

8 Replies
FTinetti
Honored Contributor I
34 Views

I think it would be easier to directly listen to a specific HTTP GET request to reboot the card.

HTH,

Fernando.

idata
Community Manager
34 Views

Hi rahulmodi8812,

 

 

Do you still need assistance with this thread? We'll be waiting for your response.

 

 

-Sergio A

 

RModi1
Novice
34 Views

Yes, I need assistance on this.

I just want a piece of java code which can reboot the Galileo.

If I don't find, I will have to move to some alternative solution.

FTinetti
Honored Contributor I
34 Views

rahulmodi8812 wrote:

Yes, I need assistance on this.

I just want a piece of java code which can reboot the Galileo.

Connect your Intel Galileo to the LAN where you have your computer running (the one in which the java code is going to run and use

/*********************************************************************/

import java.io.*;

public class javassh

{

public static void main(String args[])

{

try

{

Process p=Runtime.getRuntime().exec("ssh root@ reboot");

p.waitFor();

BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream()));

String line=reader.readLine();

while (line!=null)

{

System.out.println(line);

line=reader.readLine();

}

}

catch(IOException e1) {}

catch(InterruptedException e2) {}

System.out.println("Done");

}

}

/*********************************************************************/

Replace by your Intel Galileo Ethernet port IP

If I don't find, I will have to move to some alternative solution.

Did you think any?

HTH,

Fernando.

idata
Community Manager
34 Views

Hi rahulmodi8812,

 

 

The simplest way I can think of to reboot your board with a Java code is using a system call. This method is practically the same as the one @FGT suggested. I found a few guides on how to do this, you can check this one for example: http://alvinalexander.com/java/edu/pj/pj010016 http://alvinalexander.com/java/edu/pj/pj010016 . In this guide, it is shown how to make a system call to the command "ps -ef". The command in Linux to reboot is simply "reboot", so the material on the guide can be easily replicated.

 

 

Hopefully this will give you an idea on how to implement system calls in your code.

 

 

Regards

 

-Sergio A

 

FTinetti
Honored Contributor I
34 Views

An even simpler one...

/*********************************************************************/

import java.io.*;

public class javassh2

{

public static void main(String args[])

{

try

{

Process p=Runtime.getRuntime().exec("ssh root@ reboot");

p.waitFor();

}

catch(Exception e) {}

System.out.println("Done");

}

}

/*********************************************************************/

Replace by your Intel Galileo Ethernet port IP

HTH,

Fernando.

RModi1
Novice
34 Views

Thanks Sergio and Fernando.

I will try the solution provided by you.

idata
Community Manager
34 Views

You're welcome. Let us know your results.

 

 

-Sergio A