File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling Unix script from JSP on UNIX server

 
Monica Shiralkar
Ranch Hand
Posts: 825
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSP page using which I have to call a UNIX script.
The solution i found for this is I will have my JSP deployed on a UNIX server and it will call the UNIX script from there.


Now suppose this unix script ,I only have to transfer to UNIX server before keeping it at a particular location there and calling it.


The Problem is:

I know how to make my JSP(once deployed on UNIX) call this JSP ----FINE
But how do i transfer this UNIX script to that particular UNIX server-----I NEED SOLUTION TO THIS

thanks

 
Amit Ghorpade
Bartender
Posts: 2851
10
Fedora Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Monica. Shiralkar wrote:
But how do i transfer this UNIX script to that particular UNIX server


Are you having multiple servers?
Why not bundle that script in the WAR to put it on a particualr server or have a properties file to contain the location of the script?
I am not getting the exact problem.
 
Monica Shiralkar
Ranch Hand
Posts: 825
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes we are having having multiple servers. Now I have to create war and my war will be deployed on any unix server but how to transfer a unix script to that server.


Your idea of: bundle that script in the WAR to put it on a particualr" server sounds as solution

but my doubt is.suppose i have bundled script in the war .Now when i deploy this war.I have to keep this script at a particular location on unix server.how to transfer script from war to this unix server location where it is depoloyed.

thanks.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33671
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any reason you can't just FTP it over?

Also, be careful. The UNIX script can do anything your app server cab do. Confirm that UNIX script is well secured.
 
Monica Shiralkar
Ranch Hand
Posts: 825
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What we want to accomplish is : We want to give this WAR to our client.our client should deploy the WAR on his unix server and Run the JSP which will call the scipt(but somehow the script needs to be transfered there)..

Is it a feasible design? Please advice .
 
Prasad Krishnegowda
Ranch Hand
Posts: 665
4
Eclipse IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why can't you give your client the script file too and tell them to put it on the UNIX server (where they deploy the war file)?
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Monica. Shiralkar wrote:We want to give this WAR to our client.our client should deploy the WAR on his unix server and Run the JSP which will call the scipt(but somehow the script needs to be transfered there).

I see several problem with this approach. Firstly, if you don't know anything about the server where the script will run, then it's unlikely that the script will work on all of them. There's a large variety of Unix/Linux distributions and versions with many differences in paths, capabilities, environment variables, directory layout etc.

Secondly, on a Unix/Linux server a web app is very unlikely to have the rights to install or run shell scripts. On such systems it's common to use different user accounts for servers, especially to limit what they can do to the rest of the system. There may also be a security manager in place that governs what web apps can do on the Java level.

What does the script do that the web app can't do in Java code? It may be cheaper to spend a developer-month on adding those capabilities to the web app than to have to deal with the installation, maintenance and support issues of having to install a shell script over the lifetime of the web app.
 
Monica Shiralkar
Ranch Hand
Posts: 825
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The unix script is supposed to create a cluster of certain number of nodes for big data. Suppose we take care of the rest is there any way that the script can be bundled in the war and it can be transferred to certain location on unix server?
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most likely not, due to the issues I mentioned previously.
 
Monica Shiralkar
Ranch Hand
Posts: 825
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apart from the issues you mentioned I understand the below :

We can bundle a unix scipt inside a WAR.the deployed app can use this script.BUT there is no way this script can be AUTOMATICALLY transferred to any particular location on the server war is deployed.(Unless manually done)

please correct me if i am wrong.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the deployed app can use this script.

Are you sure about this? The script can only run if it's installed on the target machine, and that will be difficult due to the issues I mentioned.
 
Monica Shiralkar
Ranch Hand
Posts: 825
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the unix script we have tested to run standalone.now only thing is once this war is deployed there is there a way to tansfer this war to particular location say on the unix server.?
In general for any WAR is it possible to bundle a unix script and this script will be transfered to cetain location on the unix server.?

thanks
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe. Maybe not. It depends on the issues raised in all the previous answers. Is there a way that works in general? No.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic