Issue
I have several servers. And on each of the servers, I have a shell script to verify the FileSystem, and some info of some files I parse. This script renders information to the console for example
Server 1 fs /usr/user1 free 10 Gb
File 100 Processed, File 200 Processed,
etc..
The script takes about 1 minute to execute completely.
I already have a jboss server with a webapp with some servlets. I would like to create a jsp, and a servlet to run these commands on 4 different servers and display the results.
Ajax maybe??
Thanks in advance
Solution
You question is not very clear. You have several servers. Are they Webserver?
I will try to give a general answer.
Instead of waiting 1 minute, you can call the shellscripts regulary (if there are not time sensitive information)
- the shellscripts are writing to log-files on each server or in database table regularly
- from your jboss server you can access the other (web)server and get the (last) logs / DB table contents and present it.
OR
Like you suggested, with ajax.
- ajax request to the other (web)server start the shellsripts through web-interface,
- wait for processing
- display in browser
You should consider that the other (web)server are publicly accessible. So some security measures must be implemented. Multiple requests could be made too, so there should be some locks/timelimits, how often the shellscript can be called.
OR
- ajax request to the jboss-server
- jboss-server run the shellscripts remotely with ssh
- wait and present
So there is not a single solution, but many possibilities.
The logic can be distributed to browser, jboss-server and the others servers.
Answered By - code_angel
Answer Checked By - Marie Seifert (JavaFixing Admin)