ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/Configuration/scripts/mergeDaemon.pl
Revision: 1.1
Committed: Thu Jun 27 23:51:10 2013 UTC (11 years, 10 months ago) by ahart
Content type: application/x-perl
Branch: MAIN
CVS Tags: V02-03-02, V02-03-01, V02-03-00, HEAD
Log Message:
Daemon that wakes up once a minute and checks whether there are any jobs still in the condor queue from the given list of clusters. If not, then it executes the command given as the first argument.

File Contents

# Content
1 #!/usr/bin/env perl
2
3 use strict;
4 use Fcntl;
5
6 sub isDone;
7
8 my $argc = @ARGV;
9 my $fullCommand = $ARGV[0];
10 my $command = $fullCommand;
11 $command =~ s/[[:space:]]*([^[:space:]]*).*/$1/;
12 my @clusters = @ARGV[1 .. $argc - 1];
13 my $clusters = join (" ", @clusters);
14
15 while (1)
16 {
17 sleep 60;
18 if (isDone ($clusters))
19 {
20 close (OUTPUT);
21 system ("$fullCommand > $command.out.$$ 2>&1");
22 last;
23 }
24 }
25
26 sub
27 isDone
28 {
29 my $clusters = shift;
30
31 my @condorQ = `LD_LIBRARY_PATH=/usr/lib64/condor:\$LD_LIBRARY_PATH condor_q $clusters`;
32 my $condorQ = @condorQ;
33
34 return ($condorQ == 4);
35 }