]> git.uio.no Git - usit-rt.git/blob - local/bin/cron-escalate
Initial commit 4.0.5-3
[usit-rt.git] / local / bin / cron-escalate
1 #!/usr/bin/perl
2 #
3 # Author: Petter Reinholdtsen
4 # Date:   2004-08-31
5 #
6 # Based on shell version previously on
7 # <URL:http://wiki.bestpractical.com/index.cgi?ConfigureEscalationExample>
8 # and
9 # <URL:http://wiki.bestpractical.com/index.cgi?ConfigureEscalation>
10 #
11 # Run from cron as user rt-user, and make sure rt-user have
12 # permissions ShowTicket and ModifyTicket
13
14 use strict;
15 use warnings;
16
17 # Location of RT's libs and scripts
18 # Remember to change to correct path on current RT instance
19 use lib '/www/data/rt/rt-perl/current-perl10/share/perl5';
20 use lib '/www/data/rt/rt-perl/current-perl10/lib/perl5';
21 use lib '/www/data/rt/rt-perl/current-perl10/lib64/perl5';
22
23 use lib ("/www/var/rt/local/lib", "/www/var/rt/lib");
24
25 my $crontool = "/www/var/rt/bin/rt-crontool";
26
27 package RT;
28 use RT::Interface::CLI qw( CleanEnv );
29
30 # Clean our the environment
31 CleanEnv();
32
33 # Load the RT configuration
34 RT::LoadConfig();
35
36 # Initialise RT
37 RT::Init();
38
39 # escalate tickets for all queues
40 system("$crontool --search RT::Search::FromSQL --search-arg " .
41        "\"(Status='new' OR Status='open' OR Status = 'stalled')\" " .
42        "--action RT::Action::LinearEscalate  --action-arg \"UpdateLastUpdated: 0\"");