Hello Monks,

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.

[refresh] .=-----------=. | data | data | [X] <-- checkboxes |=-----+------| | data | data | [X] |=-----+-----=| | data | data | [X] '=-----------='
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 :

<form name="myform" action="not_a_cgi.pl" method="get"> <input name="checkme" type="checkbox"/></form>
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? :)


In reply to CGI "control panel" app by mojodaddy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.