I'm trying to set up a cron job which will send an email to RT.   This ticket
should spawn three child tickets.  Technically, it works.  The child tickets are
spawned however, it enters a loop and continuously spawns child tickets.  I
think it is due to the condition I've created but I'm not sure.

I've created the following template

===Create-Ticket: Patch Testing for Windows - Child
Subject: {$Tickets{'TOP'}->Subject} - Windows - Child
Parents: TOP
Queue: SysEng
Type: ticket
Content: Time to test patches for our next Windows patch cycle
ENDOFCONTENT

===Create-Ticket: Patch Testing for Solaris - Child
Subject: {$Tickets{'TOP'}->Subject} - Solaris - Child
Parents: TOP
Queue: SysEng
Type: ticket
Content: Time to test patches for our next Solaris patch cycle
ENDOFCONTENT

===Create-Ticket: Patch Testing for Linux - Child
Subject: {$Tickets{'TOP'}->Subject} - Linux - Child
Parents: TOP
Queue: SysEng
Type: ticket
Content: Time to test patches for our next Linux patch cycle
ENDOFCONTENT

and the following scrip

Condition: User Defined
Action: Create Tickets
Template: PatchTestingChildren
Stage: TransactionCreate

Custom Condition:
if ($self->TransactionObj->Type eq "Create" && $self->TicketObj->Subject =~
/^Patch Testing for\s?/){
return 1;
} else {
return 0;
}

This is the script I'm running as my cron job:

#!/usr/bin/perl

use warnings;
use strict;
use MIME::Lite;
use DateTime;

my $dt = DateTime->now;
my $month_name  = $dt->month_name;

my $emailTo   = "[EMAIL PROTECTED]";
my $emailFrom = "[EMAIL PROTECTED]";

my $emailSubj = "Patch Testing for $month_name";
my $emailMsg  = "Time to start testing patches for our next patch cycle.";

my $fullEmail = new MIME::Lite(From    => $emailFrom,
                               To      => $emailTo,
                               Subject => $emailSubj,
                               Data    => $emailMsg);

$fullEmail->send("sendmail", "/usr/sbin/sendmail -t");

-- 
Keep up with me and what I'm up to: http://theillien.blogspot.com
_______________________________________________
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