rt-crontool allows you to run cron jobs to do such things as escalating priority of tickets. It allows you to search for a set of tickets and to take specific action based on a specified condition.
rt-crontool lives in rt_install_dir/bin. The official, maintained documentation for rt-crontool is in the main RT documentation.
For usage run: rt-crontool --help
./rt-crontool is a tool to act on tickets from an external scheduling tool, such as cron.
It takes several arguments:
--search - Specify the search module you want to use
--search-arg - An argument to pass to --search --condition - Specify the condition module you want to use --condition-arg - An argument to pass to --condition --action - Specify the action module you want to use --action-arg - An argument to pass to --action --template - Specify name or id of template(s) you want to use --transaction - Specify if you want to use either 'first', 'last' or all' transactions --transaction-type - Specify the comma separated list of transactions' types you want to use --log - Adjust LogToScreen config option --verbose - Output status updates to STDOUT
This tool allows the user to run arbitrary perl modules from within RT. If this tool were setgid, a hostile local user could use this tool to gain administrative access to RT. It is incredibly important that nonprivileged users not be allowed to run this tool. It is suggested that you create a non-privileged unix user with the correct group membership and RT access to run this tool (see User Configuration below).
The following command will find all active tickets in the queue 'general' and set their priority to 99 if they haven't been touched in 4 hours:
--search RT::Search::ActiveTicketsInQueue --search-arg general \ --condition RT::Condition::UntouchedInHours --condition-arg 4 \ --action RT::Action::SetPriority --action-arg 99 \ --verbose
--search RT::Search::ActiveTicketsInQueue --search-arg general \ --action RT::Action::EscalatePriority
Location of search/condition/action modules: rt_install_dir/lib/RT/Search, Condition, Action.
(Example plugin Condition: [[[TicketIDMatches]].pm TicketIDMatches])
Read the modules (or perl docs) to see what each module does.
You may wish to wrap rt-crontool in a small script rather than call it directly from cron. e.g. to setup input parameters.
rt-crontool should ideally be run by a special unprivileged operating system user who has also been entered in RT as a privileged user with global [= ModifyTicket ] and [= ShowTicket ] rights. If you have created an operating system user named
rtcrontool, for instance, then create an RT user with
Unix login set to
Let this user be granted rights, and assign a password. Then under Configuration/Global/User rights, add the two rights to the user you just created. This user should have read access to the RT files such as RT_Config.pm and RT_SiteConfig.pm. If, for example, the
rt group has read access to all the installed RT files, you should assign your created user to that group (under UNIXen).
If you run into "/No RT user found. Please consult your RT administrator./", then you're not running
rt-crontool under the identity of an appropriate user (see previous). Somebody indicates that you can run the tool as root (uid 0), but that didn't work properly for me when using
rt-crontool to do priority escalation.
If you keep on seeing the help over and over, keep in mind that
rt-crontool requires both