ConfigureEscalationExample: Difference between revisions
Jump to navigation
Jump to search
m (2 revisions imported) |
No edit summary |
||
| Line 1: | Line 1: | ||
< | <pre>#!/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"); | |||
} | |||
</pre> | |||
Latest revision as of 17:31, 11 November 2016
#!/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");
}