Hello !
I need delete all messages inside an certain queue.
Exists some command line for this?
Thank you!
Garak garak@bol.com.br
Hello !
I need delete all messages inside an certain queue.
Exists some command line for this?
Thank you!
Garak garak@bol.com.br
Try this
#!/usr/bin/perl -w
use strict;
use Carp;
use Getopt::Long;
use lib ‘/u01/rt/rt/lib’;
use lib ‘/u01/rt/rt/etc’;
use RT::Interface::CLI qw(CleanEnv GetCurrentUser GetMessageContent loc);
CleanEnv();
use RT;
use RT::Tickets;
RT::LoadConfig();
RT::Init();
#Get the current user all loaded
my $queue = shift;
my $Tickets = new RT::Tickets($RT::SystemUser);
$Tickets->LimitWatcher(TYPE => ‘Queue’, VALUE => $queue);
$Tickets->LimitStatus(VALUE => ‘Deleted’, OPERATOR => ‘!=’);
unless ($Tickets->Count)
{
print “tickets not found with queue $queue\n”;
}
print “Amount of tickets requested by $queue is “.$Tickets->Count.”\n”;
while (my $t=$Tickets->Next)
{
print "Ticket ID: " . $t->Id . “\n”;
my ($val,$msg) = $t->Delete();
if ($val)
{
print "OK: $msg\n";
}
else
{
die "$msg";
}
}
$RT::Handle->Disconnect();
Suppose this is saved is x.pl
Then you would execute
perl x.pl <queue_name>
amit
At 05:08 PM 4/26/2004 -0300, Garak wrote:
Hello Amit !
Thank you so much!
Your script is perfect and work very well. Congratulations!
GarakOn Mon, 26 Apr 2004 16:30:21 -0400 amit poddar amit.poddar@yale.edu wrote:
Try this
#!/usr/bin/perl -w
use strict;
use Carp;
use Getopt::Long;use lib ‘/u01/rt/rt/lib’;
use lib ‘/u01/rt/rt/etc’;use RT::Interface::CLI qw(CleanEnv GetCurrentUser GetMessageContent loc);
CleanEnv();use RT;
use RT::Tickets;RT::LoadConfig();
RT::Init();
#Get the current user all loaded
my $queue = shift;my $Tickets = new RT::Tickets($RT::SystemUser);
$Tickets->LimitWatcher(TYPE => ‘Queue’, VALUE => $queue);
$Tickets->LimitStatus(VALUE => ‘Deleted’, OPERATOR => ‘!=’);unless ($Tickets->Count)
{
print “tickets not found with queue $queue\n”;
}
print “Amount of tickets requested by $queue is “.$Tickets->Count.”\n”;while (my $t=$Tickets->Next)
{
print "Ticket ID: " . $t->Id . “\n”;my ($val,$msg) = $t->Delete(); if ($val) { print "OK: $msg\n"; } else { die "$msg"; }
}
$RT::Handle->Disconnect();
Suppose this is saved is x.pl
Then you would execute
perl x.pl <queue_name>
amit
At 05:08 PM 4/26/2004 -0300, Garak wrote:
Hello !
I need delete all messages inside an certain queue.
Exists some command line for this?Thank you!
–
Garak garak@bol.com.br
RT Developer and Administrator training is coming to LA, DC and Frankfurt
this spring and summer.
http://bestpractical.com/services/training.htmlSign up early, as class space is limited.
Garak garak@bol.com.br