On Tue, Aug 23, 2016 at 10:47 AM, Tom Corcoran <[email protected]> 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 --------- RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training * Boston - October 24-26 * Los Angeles - Q1 2017
