kjg:

Since others are helping you on the Web/CGI/HTML front, I'm going to suggest a different tack: You might want to have a scheduled job that runs your batch jobs for you, and make your web interface simply trigger them. The method I use is having my scheduled job simply look for the presence of files in a particular directory. When it sees one, it executes the appropriate script with the trigger file passed in as the argument. (This way your Web app can send in any configuration values to the script--such as the EMail address to send the report to)

This way, you can avoid some of the potential security problems mentioned by ptum and the forking problem mentioned by ww. My favorite reasons for this method, however, are:

  • You don't have to tie up an http thread while your script runs.
  • Other programs can easily trigger the same jobs.
  • Easy to test!
  • A single point of control for all batch jobs. Turn off your batch job, and nothing gets processed until you restart it! (Very nice if you're trying to do some maintenance, and don't want database records changing or getting locked under you.)

    Your scheduled job can be as simple as:

    REM DOIT.BAT REM REM Note: the .pl scripts are expected to delete their command file D: cd \WORK\QUEUE :LOOP sleep 60 if exists PAUSE_JOB goto LOOP for %%J in (NME\*) do NME_Rpt.pl %%J for %%J in (PURGE\*) do Purge_Old_Files.pl %%J goto LOOP
    Note: I'm typing in the batch file from memory, so consider it untested (and likely incorrect in some details)!

    --roboticus


    In reply to Re: Am I missing something major here (system/exec)? by roboticus
    in thread Am I missing something major here (system/exec)? by kjg

    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.