Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Linux / UNIX and the fly likes Running a shell script on diff m/c through java.  Bartenders plzreply Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Reply Bookmark "Running a shell script on diff m/c through java.  Bartenders plzreply" Watch "Running a shell script on diff m/c through java.  Bartenders plzreply" New topic
Author

Running a shell script on diff m/c through java. Bartenders plzreply

s choukse
Greenhorn

Joined: Dec 12, 2001
Posts: 27
Hi
I have a java class which has to run a shell script on a different m/c.
1. Appliaction is m/c A wheer my java code is
2. Shell Script is on m/c B
Is it possible to invoke the script.
bartenders please reply on this . This is of very high priority to my application.
Chris De Vries
Ranch Hand

Joined: Dec 05, 2002
Posts: 65
You can try

Make sure include your real username, machine name, and scriptname. Also make sure ssh is installed on machineb. Also you need to make sure that ssh-agent is started to enable the ssh program to connect without prompting you for a password.
rsh can also be used, but is not as secure, although if both machines are behind a firewall, then rsh might be easier.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6913
Or you may want to use (the very unsecure) telnet. I have successfully used the telnet facility built in to "Ant" to do this sort of thing under the control of Java.


A Convergent Visionary ~ Frank's Punchbarrel Blog ~ LinkedIn profile
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Running a shell script on diff m/c through java. Bartenders plzreply
 
Similar Threads
How to call Java program main method from shell script
how to execute shell script from java class
Running Unix commands thru Java
what shell is this
FTP