This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
By using java Runtime class i can execute commands on local machines...Is it possible to excute commands and process the result on remote machine?
Giving up is the easiest thing in the world to do..but holding it together when everything seems like falling apart is true strength!!
with regards, Harish.T
Ernest Friedman-Hill
author and iconoclast
Marshal
Sure. All you need is a program running on the remote machine listening for commands to execute, and a way to communicate with that program. Lots of UNIX machines already have such a program running: it's called sshd. I suppose lots of Windows machines have such a program too; it's called Internet Explorer (baboom BOOM kish! Thanks folks, don't forget to tip your waitress!)
Can you please tell me How to proceed..i mean which class in java provide SSH connection..is it possible to do that using Runtime class..if you have any link please post that site here
Ernest Friedman-Hill
author and iconoclast
Marshal
If your servers are already running ssh, and you'll have ssh access, then there are a lot of Java SSH libraries out there to choose from.
Tony Morris
Ranch Hand
Joined: Sep 24, 2003
Posts: 1608
posted
0
Originally posted by Ernest Friedman-Hill: Sure. All you need is a program running on the remote machine listening for commands to execute, and a way to communicate with that program. Lots of UNIX machines already have such a program running: it's called sshd. I suppose lots of Windows machines have such a program too; it's called Internet Explorer (baboom BOOM kish! Thanks folks, don't forget to tip your waitress!)
If it's specifically Tomcat you want to control from afar, then you can do that via a number of Ant tasks that support that. Here is some documentation about that.
Originally posted by Ernest Friedman-Hill: Sure. All you need is a program running on the remote machine listening for commands to execute, and a way to communicate with that program. Lots of UNIX machines already have such a program running: it's called sshd. I suppose lots of Windows machines have such a program too; it's called Internet Explorer (baboom BOOM kish! Thanks folks, don't forget to tip your waitress!)
The documented way to do it would be to use Windows Scripting Host ability to call remote scripts.
Start with Server Sockets & Normal Sockets ... seems you may require RAW Sockets too. First try to develop the server socket on local machine and make sure that it is working fine then port this to remote machine and try.
1) The server socket will get the request from remote client and will perform the operation and will return back the result.
2) Remote java program will process the data and will show to the end user.
If you want to protect the data then use any wrapper over socket.
All the best
Ernest Friedman-Hill
author and iconoclast
Marshal
Start with Server Sockets & Normal Sockets ... seems you may require RAW Sockets too.
No; sorry, but this is a terrible idea. If he's going to roll his own solution, better to use either HTTP(S) or RMI. It would silly to start absolutely from scratch for this -- what would be the point?
Ernest Friedman-Hill
author and iconoclast
Marshal
Originally posted by Ulf Dittmer: If it's specifically Tomcat you want to control from afar, then you can do that via a number of Ant tasks that support that.
You can, although this mechanism falls down if (when) you need to restart an utterly frozen Tomcat -- which does happen -- because it uses Tomcat's built-in admin server. If you're local, you can kill it and restart it.
It would silly to start absolutely from scratch for this -- what would be the point?
Sorry, I did not get your point and I dont think it as writing from scratch. Already java sockets are providing enough abstraction. Do you want to use any other specific wrapper over Socket for this operation?
Ernest Friedman-Hill
author and iconoclast
Marshal
Originally posted by Srinivas Kalvala: Do you want to use any other specific wrapper over Socket for this operation?
Did you read any of the other posts in this thread (about ssh, or wsh?) or even the post you're responding to (about RMI or HTTPS?)
Robert Hill
Ranch Hand
Joined: Feb 24, 2006
Posts: 94
posted
0
I think a good(ie more flexible) solution would be to implement the telnet protocol(RFC 854) and add in ssh. Something similar to the open source program putty. http://www.chiark.greenend.org.uk/~sgtatham/putty/
It would work for starting tomcat and any other program on the remote system, provided you have permission to do so of course.
Tony Morris
Ranch Hand
Joined: Sep 24, 2003
Posts: 1608
posted
0
This stuff was invented before I was born and here we are reinventing it - perhaps for good reason. Do the existing solutions actually target the problem and nothing more? If so, why reinvent since you will have the exact same product at the end? If not, then reinvent it (make the wheel more round). More often than not, I see a reinvention without the requirement leak. In other words, a minimalism of what already exists. This is also an inherent property of Java/OO itself.
Why aren't alarm bells ringing for anyone else? Backus wrote about it the year I was born!