You are not logged in.

#1 2009-11-19 04:05:32

ybotspawn
Member
From: Oz
Registered: 2008-04-06
Posts: 140

list remote system roots

Ok, so I'm early in my search, but considering I use this distro, I figured Id post here.  Alot of the Archers are good coders anyway right?  Seriously I was trying to find a way to get remote system volumes using Java or (gasp) Mono, but if I have to use cpp i understand.  This is for a little pet project I'm playing with but I was hoping there might be something easily google'able' but apparently there wasn't.  Can anyone point me in a good direction to go with this?

thanks


"As long as people are going to call you a lunatic anyway,
why not get the benefit of it? It liberates you from convention. "

Offline

#2 2009-11-19 04:33:20

kermana
Member
Registered: 2009-04-13
Posts: 60

Re: list remote system roots

What do you mean by "get remote system volumes" ? If you mean samba shares I found a few on google like JCIFS.

Offline

#3 2009-11-20 00:28:12

ybotspawn
Member
From: Oz
Registered: 2008-04-06
Posts: 140

Re: list remote system roots

No I'm talking about smb independant.  As in is there a way to connect, if I open a port, to connect to the remote systems kernel, via like an api call, to get information about currently mounted volumes?


"As long as people are going to call you a lunatic anyway,
why not get the benefit of it? It liberates you from convention. "

Offline

#4 2009-11-20 01:11:56

Daenyth
Forum Fellow
From: Boston, MA
Registered: 2008-02-24
Posts: 1,244

Re: list remote system roots

You'd probably have to hook into ssh somehow I would think...

What problem are you trying to solve exactly?

Offline

#5 2009-11-20 15:57:46

roels
Member
Registered: 2009-03-19
Posts: 8

Re: list remote system roots

I hope this is usefull:

I think I would just use the OS commands in Java. Like this (not my code!):

import java.io.*;

public class JavaRunCommand {

    public static void main(String args[]) {

        String s = null;

        try {
            
        // run the Unix "ps -ef" command
            // using the Runtime exec method:
            Process p = Runtime.getRuntime().exec("ps -ef");
            
            BufferedReader stdInput = new BufferedReader(new 
                 InputStreamReader(p.getInputStream()));

            BufferedReader stdError = new BufferedReader(new 
                 InputStreamReader(p.getErrorStream()));

            // read the output from the command
            System.out.println("Here is the standard output of the command:\n");
            while ((s = stdInput.readLine()) != null) {
                System.out.println(s);
            }
            
            // read any errors from the attempted command
            System.out.println("Here is the standard error of the command (if any):\n");
            while ((s = stdError.readLine()) != null) {
                System.out.println(s);
            }
            
            System.exit(0);
        }
        catch (IOException e) {
            System.out.println("exception happened - here's what I know: ");
            e.printStackTrace();
            System.exit(-1);
        }
    }
}

Now instead of running "ps -ef", you could run "ssh host df -h"

Offline

#6 2009-11-20 16:54:57

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,553

Re: list remote system roots

You can export this info via SNMP. The "snmpdf" command that comes with net-snmp demonstrates how to retrieve the data, in C, from a remote snmpd.

Offline

#7 2009-11-24 04:45:30

ybotspawn
Member
From: Oz
Registered: 2008-04-06
Posts: 140

Re: list remote system roots

ataraxia wrote:

You can export this info via SNMP. The "snmpdf" command that comes with net-snmp demonstrates how to retrieve the data, in C, from a remote snmpd.

Perfect, thanks, I'll give this a go.  To answer the previous question, I was simply curious how I would do it.  I do .net, cpp, and java development during the day and I like to be able to find similar solutions for linux, for the problems I may have solved on windows and vica versa.  I just wasn't sure where to start with this one as .net does have an advantage in WMI.  Make sense?  Thanks everyone, I'll post some code later.


"As long as people are going to call you a lunatic anyway,
why not get the benefit of it? It liberates you from convention. "

Offline

Board footer

Powered by FluxBB