Something similar we're using at present.

We have 12 processes running on a remote Windows server, each started by a batch file. I added a line to each batch file, right after the line that invokes the actual process, to set the window title to "Doornail path/batchfile"; this identifies a process that has aborted. The perl looks for Doornail in the tasklist, kills the aborted ("zombie") window, and uses the second part of the window title to restart it. The loop is to limit how long this runs; I don't quite trust it to run on its own yet.

use strict; use warnings; my $looper = 0; my $qtrs = shift || 4; while ($looper < (4*$qtrs)+1) { my $counter = 0; $looper += 1; my @zombies = grep { $_ =~ /Doornail/ } `tasklist /v`; foreach my $z (@zombies) { $counter += 1; my ($pid, $batch) = (split /\s+/,$z)[1,10]; my ($path,$cmd) = $batch =~ m:^(.+/)([^/]+)$:; `taskkill /pid $pid`; chdir "/applications/JEDI/$path"; $batch = "start $cmd"; system($batch) } printf "Loop %d, restarted %d processes\n",$looper,$counter; sleep 15*60; }

Updated for clarity

1 Peter 4:10

In reply to Re: Using Map and RegEx for data extraction by GotToBTru
in thread Using Map and RegEx for data extraction by ajose

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.