LinuxCMD.java 1.21 KB
package org.emercit.model;


import java.io.*;

public class LinuxCMD {

	
 public  void 	ConfigLanStatic(String eth, String address, String gateway, String netmask, String password) { 


	    String pas = password;
	    
	    String[] array= { "nano"};
	    
		    	    
	    Process proc = null;
	    BufferedWriter writer = null;
	try
	{
	    proc = Runtime.getRuntime().exec(array);
	        writer = new BufferedWriter(new OutputStreamWriter(proc.getOutputStream()));
	        writer.write(pas);
	}
	catch (IOException e)
	{
	 			
	}
 }
 

 
 public void RestartInterfaces() { 
	 
	 
	    String[] array= { "/etc/init.d/networking restart"};
	    
		    	    
	    Process proc = null;
	    BufferedWriter writer = null;
	try
	{
	    proc = Runtime.getRuntime().exec(array);
	      try {
	    int res=proc.waitFor();
	      }
	      catch (Exception e) {
	    	  
	      }
	    //  writer = new BufferedWriter(new OutputStreamWriter(proc.getOutputStream()));
	       // writer.write(pas);
	}
	catch (IOException e)
	{
	 			
	}
	 
	 
	 
	 
	 
 }
 
 public void ConfigLanDHCP(String eth, String password) { 
	 
	 try 
	 {
		
		 
	 }
	 catch(Exception e) {
		 
		 
	 }
	 
	 
	 
 }
 
 
 public void InstallTiemViewer() { 
	 
 
 }
	

 
}