minixman has asked for the wisdom of the Perl Monks concerning the following question:
i have a web cgi form, that take input from a user, and then uses that input to set the server up to run certain commands. so a user would select for example run vmstat: so you grab the input from the form, and then you would like to run vmstat with a time value after it like " vmstat 5 " how would you output this onto the html screen, so the user can see the results.
EG :
my $cmd = $q->param('cmd'); # From html form print <<EndHTML; <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 <br>Transitional//EN"> <html> <head> if ($cmd =~ /vmstat/) { printf "Starting to run :$cmd</a>\n"; # Would run something like system("vmstat 5") here } } print <<EndFoot; </body></html> EndFoot
edited by ybiC 2003-07-16 : <code> tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI running local shell scripts
by LazerRed (Pilgrim) on Jul 16, 2003 at 16:30 UTC | |
|
Re: CGI running local shell scripts
by Anonymous Monk on Jul 16, 2003 at 16:49 UTC | |
by minixman (Beadle) on Jul 17, 2003 at 13:24 UTC | |
|
Re: CGI running local shell scripts
by TomDLux (Vicar) on Jul 16, 2003 at 16:21 UTC |