On 17/07/2008, at 12:45 AM, Matthew Macdonald-Wallace wrote:

Hi Tom,

Please forgive the intrusion into your inbox, I noticed your post dated
23rd June on the rt-users list archives and I am very interested in
your usage of rt-crontool to automatically re-open any stalled tickets
older than a certain age.

Would it be possible for you to share the command-line arguments you
have used for rt-crontool with the community?

Thanks in advance,

Matt


Hi Matt,

No problems - sorry for the delay getting back to you. I've CC'd the list as well in case anyone else is curious.

We currently run something like this, once per day:

## Search for tickets that have had no requestor correspondance for more than 6 days,
## open them and comment (this will notify ticket owner)
/var/www/rt.domain.com/rt/bin/rt-crontool \
        --search RT::Search::FromSQL \
--search-arg "Queue = 'Foo' AND Status = 'stalled' AND Told < '6 days ago' AND DependsOn IS NULL" \ --action RT::Action::OpenTicketAndComment --action-arg "Auto- opened due to being stalled for > 6 days."


You'll also notice the RT::Action::OpenTicketAndComment action which is just a slightly modified RT::Action::AutoOpen so that we can also place a comment in the ticket to show why it was re-opened. I've attached our local/lib/RT/Action/OpenTicketAndComment.pm module if you're interested.

Caution: we added the 'DependsOn IS NULL' clause because this was re- opening tickets that were stalled because they depended on another ticket. However, through TicketSQL we are unable to query the status of these depended-on tickets, so currently this won't re-open stalled tickets even if a depended-on ticket is resolved. I consider this a bug with our process and plan to fix it by using a custom RT::Search module to do a more fine-grained query, but haven't had time.

Regards,
Tom

package RT::Action::OpenTicketAndComment;
use base RT::Action::AutoOpen;

sub Commit {
    my $self = shift;
      my $oldstatus = $self->TicketObj->Status();
        $self->TicketObj->__Set( Field => 'Status', Value => 'open' );
        $self->TicketObj->_NewTransaction(
                         Type     => 'Status',
                         Field    => 'Status',
                         OldValue => $oldstatus,
                         NewValue => 'open',
                         Data => $self->Argument,
        );
	$self->TicketObj->Comment(
			Content => $self->Argument,
	);


    return(1);
}

=head1 DESCRIPTION

A slight modification to the AutoOpen action, so that we can change the
Transaction 'Data' field and Comment on the ticket.

=head1 AUTHOR

Tom Lanyon

=cut

1;

_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

Reply via email to