Invoking UNIX shell commands from HTML webpage
Hello all,
I have a few questions regarding HTML, UNIX and Javascript. I've been tasked with creating a fairly simple webpage that takes a few inputs. Each input must correspond to an argument in a UNIX command running on a server. Here's the background. On a UNIX server we have a script (.ksh) that takes 3 arguments. The result of the script is a data file which is FTP'ed to an external server. Let's forget about the FTP portion for now. I would like to know where I should begin. What I know so far: 1) I will need HTML to create the webpage. Skill level is high 2) I will need Javascript to make my webpage more interactive. Skill level is high. 3) I will need to understand the UNIX environment. Skill level is high. What else will I need to complete this task? Thanks in advance! |
You'll need to unsderstand the glue between the "HTML" page and the Unix environment and how to set up your Web server to execute the script. I say "HTML" because straight HTML can't do this. You'll need a script written in Perl, PHP, Python, Ruby, ... to call the Unix commands. These scripting languages can make generating the HTML require less typing, too.
You'll also need to understand security, input validation, and the like. Having a web-accessible page call Unix commands should be setting off alarm klaxons in your head. |
So Javascript won't work?
I see that you mentioned a 'web server', must I set up an Apache server? |
I don't think JavaScript can call external programs, no, but I don't use it much.
You don't have to use Apache.. you can use Lighttpd, nginx, IIS.. whatever Web server you want. But you generally need a Web server to serve up Web pages. |
Quote:
Perl and PHP are two great choices. Scan through this tutorial (or Google for any of a million others): http://www.lies.com/begperl/ Quote:
http://www.perlmonks.org/?node_id=78523 WARNING: Executing *any* user commands on the server is a *huge* potential security risk. No matter *how* you do it. Be careful! Here's another good link: http://perldoc.perl.org/perlsec.html |
Quote:
The originator in the same terms as WRT phone conversation. |
Thanks guys!
The websites you guys provided are all very helpful. I will try the following: 1) upgrade my ubuntu machine 2) install apache 2.2 on ubuntu 3) create simple webpage 4) create a simple unix script (to be invoked by the webpage) 5) read up on PHP and Perl (not sure with one i will use) can someone please touch upon the security aspect of this implementation? from a security perspective, all of my development will be localized to my unix server. all webpages, scripts, etc... will be created and run from one machine; and i will be the only person with access. Of course when i look to implement a bigger solution i will have to think about the security risks. |
Quote:
What the OP needs is _server-side_ scripting: PHP, Perl, Ruby, and the like |
Quote:
|
All times are GMT -5. The time now is 03:56 AM. |