[rt-users] rt-shredder & bash script
Matt Zagrabelny
mzagrabe at d.umn.edu
Tue Aug 23 12:28:13 EDT 2016
On Tue, Aug 23, 2016 at 10:47 AM, Tom Corcoran <tomc at osits.com> wrote:
> Hi
>
> Noob question here.
> Trying to use rt-shredder from a bash script using a bash date variable to
> wipeout tickets but shredder seems to ignore my date parameter which I
> assume is because its badly formatted.
>
> Have gotten this to work using a fixed date/time -
>
> #!/bin/sh
> filename=`date +%Y%m%dT%H%M%S-0001.sql`
> /opt/rt4/sbin/rt-shredder --sqldump /opt/stf/backups/rt-shredder/$filename
> --force --plugin Ti
> ckets=query,"(Queue = 'Supplier invoices') AND status = 'resolved' AND
> resolved > '2016-08-01 00:00:00.00' ;limit,2000"
>
> but I would like it to work like this -
>
> #!/bin/sh
> filename=`date +%Y%m%dT%H%M%S-0001.sql`
> cutoff=`date +%Y-%m-%d --date='2 years ago'`
> cutoff="'$cutoff 00:00:00'"
> echo $cutoff
> /opt/rt4/sbin/rt-shredder --sqldump /opt/stf/backups/rt-shredder/$filename
> --force --plugin Ti
> ckets=query,"(Queue = 'MCL - Supplier invoices') AND status = 'resolved' AND
> resolved > $cuto
> ff ;limit,2000"
I believe shredder will respect relative time constraints:
1 day ago
etc.
You could try passing a relative date to shredder (thus bypassing the
call to date) and seeing if that works.
-m
More information about the rt-users
mailing list