|Perl: the Markov chain saw|
CGI "control panel" appby mojodaddy (Pilgrim)
|on Jul 24, 2007 at 03:09 UTC||Need Help??|
mojodaddy has asked for the
wisdom of the Perl Monks concerning the following question:
If I were to summarize what I'm trying to do, I think it comes down to this: I would like to find a way to access the shell by manipulating an HTML form on a CGI web page.
I built a CGI "control panel" that I use to monitor various processes that run on my system. Basically the CGI queries a database and shows the results in tabular form on a web page served by localhost. (It's only used by me locally.) I have a nice big "refresh" button on it and throughout the day I update the page to see what's going on.
The processes themselves are perl scripts that I start and stop from the command line, and I use the data from the control panel page to decide what to start/stop and when.
It works, but it's become a bit unwieldly lately in the sense that I am having to keep multiple console windows open, and flipping through the windows to find the right one is a clumsy process. I tried running them as background processes that print their output to logfiles and then periodically doing a tail -f but the problem is if I don't see it, I tend to forget about it.
I am imagining enhancing my control panel page to allow me to start and stop each process via the HTML form, specifically with checkboxes. Checked, the program takes off running. Uncheck it and it stops.
And ideally (though I may be getting over my head here) some way to monitor the output like via tail. And I don't want to have to rewrite all the scripts to make them into CGIs! ;)
What I can't seem to figure out is how or whether a CGI can execute a non-CGI script. Something like :
and some sort of event handler, I guess, so that I can start/stop the processes by just changing the checkbox instead of having to "submit" the form.
Is any of this possible?
A slight aside: In one of my google searches (or maybe it was here on PM) I came across something like this:
<script type="text/perlscript">[perl code here]</script>
But when I tried it my Firefox browser just laughed at me. Is that some kind of old-school thing? :)