I am working on a web UI using perl CGI. I have to run a script from UI and when it finishes its execution (which takes about one hour) then rename a .png file and then I have to kill some processes. here is what I am doing for it.

system "sudo -E ./top_apps.sh stats.log > dev/null &"; $pid=`sudo -E pgrep top_apps.sh -d "," | xargs echo`; system "sudo -E ./run_test.sh > /dev/null ; mv ./img/stats.log_cpu.png + ./img/stats.log_cpu$stats_no.png ; pkill $pid &;

Now when I am doing just the following

system "sudo -E ./top_apps.sh stats.log > dev/null &"; $pid=`sudo -E pgrep top_apps.sh -d "," | xargs echo`; system "sudo -E ./run_test.sh > /dev/null &;

its working fine but when I am adding commands to rename and kill PIDs web UI is giving error that 'No data Received'. When I am running this command directly from shell its working fine all the processes are going on one after one. Please tell me what is wrong in this or if there is any other method to do tasks one after one in perl.


In reply to Executing next system command one first one is compete by Striker

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.