Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 web.

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?

like image 930
London Avatar asked Oct 12 '10 12:10

London


2 Answers

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.

like image 77
Octavian A. Damiean Avatar answered Oct 17 '22 01:10

Octavian A. Damiean


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.

like image 24
Codemwnci Avatar answered Oct 16 '22 23:10

Codemwnci