开发者

Advice on which language to use

I'm trying to create a web application which will get input from system.

What this application should do is to listen what happens when some shell scripts are executing and reporting the status trough web.

An example :

  • I'm copying thousands of records with shell script, and while this is still executing I'd like pass the current status of the script to the web interface. From shell script side I could echo something like "The files are being copied please wait for it to finnish".

Using which programming language from shell side would be the easiest way to pass this to the web interface? I intended to use JSP/JAVA for 开发者_如何学Pythonweb.

Is this even the right way to think about this? Every suggestion is welcome

EDIT

Would something like http://nodejs.org/ be useful for this?


I'd use a named pipe (FIFO) instead. You simply write your output to the pipe and let the application read it. I'm not sure if there is any other way to get a more live system than this.

I'd recommend Perl as the back-end.

EDIT:

named pipes are a special type of files on UNIX. The abbreviation FIFO stands for "First In First Out". On LINUX Journal you can find an interesting read about named pipes.

Perl is a very powerful scripting language with many ready-to-use modules which you can find on http://cpan.org. You can find some answers here on SO about how/where to start learning Perl.


The Web part of your application can easily read a file or a database, so you just need to make sure that your shell scripts are outputting something for your Java code to update.

For example, if you run your shell script like this

./myscript.sh > mylog.log

Then in your Java code (note that you should not have logic in your JSP), you can read in the file to determine the status of the update, and output the result to your JSP.

It would be better to read the data in from a database, but that would involve you changing your shell script to output the data to a database.


You could put shell script output to some storage on server. And use AJAX on the web page to poll the server and get updates from that storage to the page.

If you will decide to use JSF for web page creation I can recommend "a4j:poll" component from ajax2jsf library. It is very simple and straightforward. Very easy way to poll server from the web page.


Writing to log file would be the simplest solution. And in programming, simple often means good.

If you really need very fast/realtime system, you should probably make these logs a database.

As for language, use what you like best. They all do support SQLite, including bash.


If I understand your question correctly you want to display a web page on a client machine that reports the status of a long running task on a server machine. If that is the case then you need to focus on something called AJAX IMO.

For what it is worth the simplest and easiest to understand implementation of AJAX that I know of is Apache Wicket.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜