[rt-users] cron job for creating tickets and child tickets
Mathew
theillien at yahoo.com
Thu Sep 27 14:17:37 EDT 2007
Anyone have any thoughts on this?
Keep up with my goings on at http://theillien.blogspot.com
Mathew Snyder wrote:
> 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 = "sysengdev\@rt-devel.ops.servervault.com";
> my $emailFrom = "msnyder\@servervault.com";
>
> 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");
>
More information about the rt-users
mailing list