RT cron job script every night

Hello All,

We have a requirement to shred old tickets which are older than a 3 year limit 200.

we have to set up cron job that runs that script every night.

Can someone help , how do i proceed with this request, what particular steps?

Do you have experience using the shredder?

this should help: rt-shredder - RT 5.0.2 Documentation - Best Practical

I run executing the shredder particular command from, which not found.
rt-shredder --plugin “Tickets=query,Status = ‘resolved’ AND LastUpdated < ‘3 years ago ago’;limit,200” --sqldump /{somepath}/shredder-restore-tickets.sql".

is it not finding the shredder? have you tried the full path to it? something like /opt/rt5/sbin/rt-shredder --plugin etc etc

Cron works best when everything is fully pathed. Cron doesn’t have any environment, so anything you need has to be created in the cron command (or in the cron file if you are using one of the /etc/cron.* directories). You can add environment variables to the top of the files:


          • username cron-command

I usually just add all of the needed environment variables into a file then do:

source /file/name;command

In the cron entry

You may also need to run perl to execute the shredder. sometimes the shebang line (#! /bin/env perl) doesn’t get picked up by cron. This doesn’t happen every time, but I see it occasionally. So you’d have to make the cron command:

          • /usr/bin/perl /opt/rt5/sbin/rt-shredder …