Variable rtname not valid when executing rt-crontool


We have set rtname in a to our company name. Everything works fine except when executing rt-crontool from crontab to for example send out a reminder of stalled tickets with a template as message. Then the subject has the string [ #123456] “” is stalled

/opt/rt4/bin/rt-crontool --search RT::Search::FromSQL --search-arg “Status = ‘stalled’ AND Due is NULL AND Told < ‘7 days ago’ AND Queue = ‘Support’ AND Owner != ‘Operations’” --action RT::Action::RecordComment --template ‘Stalled tickets’

Is not read when executing rt_crontool?


Then the subject has the string [ #123456] “” is stalled

The “” Is the incorrect value?

Yes exactly, “” is the default incorrect value. We want what we have set rtname to in

And the name shows up correctly on the RT web UI, not as

Sorry for being unclear. It’s in emails the subjects are wrong, “” not overridden with organisation name, when sent from crontab using rt-crontool. Correspondance sent from RT web UI gets the correct subject. It seems to us is not read when using rt-crontool for correspondance.

Okay, if you go to the ticket that rt-crontool forwarded on can you confirm that the ticket has a value for subject?

We don’t forward any ticket. We use a query (see thread start) and a template to create a comment in all tickets which have been stalled to long. The comment triggers an email to be sent to the ticket owner and to RT-Send-Cc. The subject of the sent email is prefixed with [] though we have changed rtname in to mirror our organisation.

Example of template created in RT-Admin-Global-Templates:
Subject: “{$Ticket->Subject}” is stalled


Ticket {$Ticket->id} is stalled for seven days or more with no customer communication. Please consider to put the ticket in status pend_client.

Queue: {$Ticket->QueueObj->Name}
Subject: {$Ticket->Subject || “(No subject given)”}
Owner: {$Ticket->OwnerObj->Name}
Requestors: {$Ticket->RequestorAddresses}
Status: {$Ticket->Status}
Ticket URL:{$Ticket->id}

RT Timed Notifications

Right, my mistake on the forward part. Does the ticket have a subject value? Or do you see “(No subject given)” for the body of the tickets where you see “[ #123456] “” is stalled” as the email subject header?

Yes, subject as specified in the template but prefixed with [ #ticket number].

Example from today:
[ #741632] “Company Portal: Documents are not working” is stalled

If the ticket that the crontool is sending the email out for doesn’t have a subject value then the header for the email subject here Subject: “{$Ticket->Subject}” is stalled will be empty quotes around the ticket subject, like you are saying you are seeing. You could change the code to this if you wanted to have a message saying no subject was provided:

Subject: “{$Ticket->Subject || '(No subject given)'}” is stalled

No. We have a subject in the ticket and it’s correct in the email sent out but it’s prefixed with [example. com] though we have configured rtname in to reflect our organisation.

In my example above “Company Portal: Documents are not working” is the subject but as you can see it has as prefix. Example if rtname =

[] #741632] “Company Portal: Documents are not working” is stalled

[] #741632] “Company Portal: Documents are not working” is stalled

Two ideas:

a) Have you cleared the Mason cache and restarted the web server on the RT machine?

b) Do a recursive grep for “” in the /opt/rt4/ hierarchy to see if it appears anywhere. For example if you have a /opt/rt4/local/etc/ it will take precedence over /opt/rt4/etc/ (assuming RT is built in /opt/rt4 obviously).


Thank you for your reply.

a) Yes

b) I’ve done recursive grep earlier and investigated the result but will do it again.


Just a thought here: did the original tickets get created before you changed the settings to

Also check (as this has happened before) that you don’t have two Set($rtname, '....'); calls in your (easy to do by accident if you either have long config, or split it into separate files in a subdirectory).