Александр Поляков wrote:
> Hi,

Hello Alexander.

> How to use cmd operations around many hosts by smartfrog?
> 
> *There is my code (192.168.56.1 is localhost):*
> 
> #include "org/smartfrog/services/shellscript/components.sf"
> #include "org/smartfrog/components.sf"
> Make_Dir extends Script{
>     shell LAZY ROOT:Shell;  
>     startScript["mkdir c:\\dir_1"];  
> }
> sfConfig extends Compound{
>     Shell extends WinXPShell;  
>     Make_Dir_1 extends Make_Dir{  
>        sfProcessHost "192.168.56.1"  
>     }
>     Make_Dir_2 extends Make_Dir{
>         sfProcessHost "192.168.56.101"
>         startScript["mkdir c:\\dir_2"];
>     }
> }
> 

So you are trying to deploy the shell on different machines?

Let me look at the code. and stack trace

(pause)

OK the script component works by issuing commands to the deployed shell, 
but the way it is set up is that it is designed for in-JVM use, so the 
shell and the script have to be in the same JVM. Looking at the code and 
the way it does locks and things I can see this is hard to remote.

what you have to do is deploy the shell script and the command in the 
same process, which is easily done: just deploy both together on the 
target machine. Something like the following should work


RemoteCommand extends Compound {
   command TBD;
   Shell extends WinXPShell;
   Make_Dir extends Script{
     shell LAZY PARENT:Shell;
     startScript [command];
   }
}

MakeDirectories extends Compound {
   RemoteCommand_56_1 extends RemoteCommand {
     command "mkdir c:\\dir_1";
     sfProcessHost "192.168.56.1";
   }
   RemoteCommand_56_101 extends RemoteCommand {
     command "mkdir c:\\dir_2";
     sfProcessHost "192.168.56.101";
   }
}


The other thing to know is that filesystem operations are so common we 
have some special components to work with them, the mkdir one being how 
to create directories; you can also configure it to clean the directory 
on startup and to try and delete the directory when being shut down. If 
all you want to do is create some directories, that's easier to use:

#include "/org/smartfrog/services/filesystem/components.sf"

Mkdir_1 extends Mkdir {
   sfProcessHost "192.168.56.1";
   dir "c:\\dir_1";
}


Mkdir_101 extends Mkdir {
   sfProcessHost "192.168.56.101";
   dir "c:\\dir_2";
}

-Steve

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Smartfrog-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/smartfrog-users

Reply via email to