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.8 by ahart, Wed Dec 12 21:38:19 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 +    deleteEntry ($id) if lc ($response) eq "y";
109 +    system ("crab $arg");
110 +  }
111   else
112    {
113      system ("crab $arg");
# Line 268 | Line 286 | dbReport
286    $db->selectdb ("ntuple");
287    $results = $db->query ($query);
288  
289 +  return $results;
290 + }
291 +
292 + sub
293 + deleteEntry
294 + {
295 +  my $id = shift;
296 +
297 +  my $results;
298 +  my $query = "delete from ntuple where id=$id";
299 +  $db->selectdb ("ntuple");
300 +  $results = $db->query ($query);
301 +
302    return $results;
303   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines