ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/DBTools/scripts/osucrab
(Generate patch)

Comparing UserCode/OSUT3Analysis/DBTools/scripts/osucrab (file contents):
Revision 1.7 by ahart, Wed Dec 12 20:44:29 2012 UTC vs.
Revision 1.9 by ahart, Wed Dec 12 21:54:15 2012 UTC

# Line 10 | Line 10 | sub dbReport;
10   sub dbInsert;
11   sub addSlashes;
12   sub getOption;
13 + sub deleteEntry;
14  
15   our $db = Mysql->connect ("cmshead.mps.ohio-state.edu", "ntuple", "osuT3User") or die "Failed to connect to Tier 3, stopped";
16  
# Line 90 | Line 91 | elsif ($arg =~ m/-status/)
91      my $results = dbStatus ($id, $currentStatusName, "$ENV{'USER'}\@$ENV{'HOSTNAME'}") if $id > -1;
92      unlink ($currentStatusName);
93    }
94 + elsif ($arg =~ m/-kill/)
95 +  {
96 +    my $workingDir = getWorkingDir (\@ARGV);
97 +    my $id = -1;
98 +    if (-e "$workingDir/log/.osuID")
99 +      {
100 +        open (ID_FILE, "<$workingDir/log/.osuID");
101 +        $id = <ID_FILE>;
102 +        close (ID_FILE);
103 +        $id =~ s/(.*)\n/$1/;
104 +      }
105 +
106 +    print "Are you cancelling this task? (y/N): ";
107 +    my $response = <STDIN>;
108 +    $response =~ s/\n//g;
109 +    deleteEntry ($id) if lc ($response) eq "y";
110 +    system ("crab $arg");
111 +  }
112   else
113    {
114      system ("crab $arg");
# Line 268 | Line 287 | dbReport
287    $db->selectdb ("ntuple");
288    $results = $db->query ($query);
289  
290 +  return $results;
291 + }
292 +
293 + sub
294 + deleteEntry
295 + {
296 +  my $id = shift;
297 +
298 +  my $results;
299 +  my $query = "delete from ntuple where id=$id";
300 +  $db->selectdb ("ntuple");
301 +  $results = $db->query ($query);
302 +
303    return $results;
304   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines