ConfigureEscalationExample

From Request Tracker Wiki
Jump to navigation Jump to search
#!/usr/bin/perl
#
# This script is one way to escalate ticket priorities for all queues.
#
# Author: Petter Reinholdtsen
# Date:   2004-08-31
#
# Based on shell version previously on
# <URL:http://wiki.bestpractical.com/index.cgi?ConfigureEscalationExample>
# and
# <URL:http://wiki.bestpractical.com/index.cgi?ConfigureEscalation>
#
# Run from cron as user rt-user, making sure rt-user is also a privileged
# RT user with 'Unix name' set to rt-user and having global permissions
# ShowTicket and ModifyTicket.
 
use strict;
use warnings;
 
# Location of RT3's libs and scripts
use lib ("/site/rt3/lib", "/site/rt3/local/lib");
my $crontool = "/site/rt3/bin/rt-crontool";
 
package RT;
use RT::Interface::CLI qw(CleanEnv);
 
# Clean our the environment
CleanEnv();
 
# Load the RT configuration
RT::LoadConfig();
 
# Initialise RT
RT::Init();
 
my $queues = new RT::Queues($RT::SystemUser);
$queues->LimitToEnabled();
 
# escalate tickets for all queues
while (my $queue = $queues->Next) {
    my $queuename = $queue->Name;
    system("$crontool --search RT::Search::ActiveTicketsInQueue " .
          "--search-arg \"$queuename\" ".
          "--action RT::Action::EscalatePriority");
}