Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Using Map and RegEx for data extraction

by GotToBTru (Prior)
on Oct 15, 2014 at 22:23 UTC ( [id://1103979]=note: print w/replies, xml ) Need Help??


in reply to Using Map and RegEx for data extraction

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1103979]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-24 21:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found