Perl script to disable an RT "scrip"

Hi,

We create RT installations by the dozen, and I’ve got most of it automated, but the one remaining piece is disabling scrip #12 which advises users when their ticket has been resolved. (We resolve tickets on an ad-hoc basis and thus don’t care to have a user whose issue was dealt with two months ago suddenly get a “your ticket has been marked as resolved” message about something they don’t even remember and then they write back confused, etc.)

That is to say, I want to write a shell/perl/whatever script of some kind which does the same thing as manually going to Admin:Global:Scrips:Select, clicking on scrip #12, unchecking the “enabled” box, and pressing “save”. Rather than having to do this manually for each new installation.

I’ve previously managed to get together a perl scrip to adjust the user rights as we need them for a new RT world. Is there something I can do in perl to manipulate the enabledness of scrips? After doing “use lib ‘/usr/share/request-tracker4/lib’;” there does indeed seem to be a “use RT::Scrip;”, and I can even do an “RT::Scrip->new(something)”, although it doesn’t seem to matter what the something is, and anyway I have no idea what methods I could use on the object which this returns.

And I can’t find any documentation about all this.

Thanks for any pointers.

You can use the RT Perl API (untested but something like this):

#!/usr/bin/perl

use strict;
use warnings;

use lib qw(/path/to/rt5/local/lib /path/to/rt5/lib);

use RT::Interface::CLI qw(Init);

Init();

my $scrip_12 = new RT::Scrip( RT->SystemUser );
my ($ret, $msg) = $scrip_12->( 12 );
unless ($ret) {
    die "Failed to load scrip 12";
}

($ret, $msg) = $scrip_12->SetDisabled( 1 );
unless ($ret) {
    die "Failed to disable scrip 12: $msg";
}
$RT::Logger->info("Successfully disabled scrip 12");

Thanks! Looks like you’re missing the method name “Load” in “$scrip_12->( 12 );”, but with that inserted it works! (Or please let me know if I should have put something else there)