Hello Cem,
when using jsch, there is no reason to use screen.
You can just create as many parallel channels, as
you like.
Exec.java from jsch examples contains all the helpful hints.
I assembled a JUnit test and a simple UserInfo which provides
either password, or keyfile/passphrase and does not insist on
knownHost checks.
In other words: NOT FOR PRODUCTION USE (especially the
known hosts check can be added easily, if you have an openssh
client around to seed the known hosts file).
Put the files in package test, add nlog4j (combines slf4j and
log4j) and jsch.jar, change user, host and password
(or use the other constructor of SSHUserInfo) and run the JUnit test.
The test method needs a refactoring and the SSHUserInfo should be
named SshUserInfo, but you get the picture.
Hope this helps,
Heiner
bce...@ya... wrote:
> hello,
>
> i am a newbie in linux and hope the question makes sense...
>
>
> i want to execute a linux command from a java class in order to automate
> a process that i make in putty...
>
> what i make on shell is
>
> 1. screen -R Test (creating a new screen)
> 2. then changing directory (cd myDir)
> 3. and there executing a command (do xxxxx)
>
> is there anyway to achieve this by JSch ??
>
> any idea appreciated
> regards cem
>
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> JSch-users mailing list
> JSc...@li...
> https://lists.sourceforge.net/lists/listinfo/jsch-users
>
--
Heiner Westphal
Peter-Michely Str. 18
D-66117 Saarbrücken
Mail : wes...@he...
Tel. : +49-(0)681-5006118
Mobil: +49-(0)177-5752640
|