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 |
|
|
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"); |
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 |
|
} |