[rt-users] cli command to delete old tickets with shredder
Ruslan Zakirov
ruz at bestpractical.com
Thu Apr 25 17:23:45 EDT 2013
Don't change the script. Change status first.
UPDATE Tickets SET Status = 'deleted' WHERE LastUpdated ....
Also, LastUpdated is better date unless you have a reason.
On Tue, Apr 9, 2013 at 2:46 PM, Flavio Moringa <
flavio.moringa at caixamagica.pt> wrote:
> Huumm... still didn't try it but this query should do the trick:
>
> DELETE FROM Tickets WHERE Created <= date_sub(NOW(), interval 2 year);
>
> Cheers
>
> *Flávio Moringa*
> Project Leader
>
>
>
> Caixa Mágica Software
> Energia Open Source
> Rua Soeiro Pereira Gomes, Lote 1 - 4.º B,
> Edifício Espanha, 1600-196 Lisboa - Portugal
> Tel.: +351 217 921 260 Fax: +351 217 921 261
> http://www.caixamagica.pt
> https://twitter.com/flaviomoringa
> https://www.facebook.com/flaviomoringa<https://www.facebook.com/flavio.moringa>
> http://pt.linkedin.com/in/flaviomoringa
> http://people.caixamagica.pt/flaviomoringa
>
>
>
> 2013/4/9 Flavio Moringa <flavio.moringa at caixamagica.pt>
>
>> I,
>>
>> thanks a lot for your help....
>>
>> The util "rt-delete-tickets-mysql" seems to be perfect for what I
>> want.... I just have to change the initial query from:
>> "DELETE FROM Tickets WHERE Status = deleted"
>> to
>> "DELETE FROM Tickets WHERE LastUpdate = '2 year ago'"
>>
>>
>> Now I just have to find the right query...
>>
>> Again thanks a lot for your help... I didn't know about that utils
>> package...
>>
>> Cheers
>>
>> *Flávio Moringa*
>> Project Leader
>>
>>
>>
>> Caixa Mágica Software
>> Energia Open Source
>> Rua Soeiro Pereira Gomes, Lote 1 - 4.º B,
>> Edifício Espanha, 1600-196 Lisboa - Portugal
>> Tel.: +351 217 921 260 Fax: +351 217 921 261
>> http://www.caixamagica.pt
>> https://twitter.com/flaviomoringa
>> https://www.facebook.com/flaviomoringa<https://www.facebook.com/flavio.moringa>
>> http://pt.linkedin.com/in/flaviomoringa
>> http://people.caixamagica.pt/flaviomoringa
>>
>>
>>
>> 2013/4/9 Bart <bart at pleh.info>
>>
>>> This page contains the info on the command:
>>>
>>>
>>> - http://bestpractical.com/rt/docs/3.8/rt-shredder.html
>>>
>>>
>>> And some info if you want to use the API:
>>>
>>>
>>> - http://bestpractical.com/rt/docs/3.8/RT/Shredder.html
>>>
>>>
>>> Another thing you might want to look at are the extension Utils:
>>>
>>>
>>> -
>>> http://search.cpan.org/~ruz/RT-Extension-Utils/lib/RT/Extension/Utils.pm
>>> - http://search.cpan.org/~ruz/RT-Extension-Utils/MANIFEST
>>>
>>>
>>> As Kevin puts it, Utils are Ruslans bag of tricks. It also contains a
>>> commando for extracting attachments/deleting tickets, so maybe that's what
>>> you can use to make things a bit more easy. (the manifest page shows the
>>> included commands)
>>>
>>>
>>> Hope this helps a little.
>>>
>>>
>>>
>>> 2013/4/8 Flavio Moringa <flavio.moringa at caixamagica.pt>
>>>
>>>> I guys,
>>>>
>>>> I haven't come across a straight answer to this, so my apologies if
>>>> this has been answered before.
>>>>
>>>> I have a 3.6 Request Tracker instance running.... (and no.. updating
>>>> right now is not possible)....
>>>>
>>>> I want to delete all tickets (and respective attachments, etc) that are
>>>> older than 2 years...
>>>>
>>>> My approach is using rt-shredder... by installing the cpan module (
>>>> http://search.cpan.org/dist/RTx-Shredder/lib/RTx/Shredder.pm)
>>>>
>>>> So what is the cli command to do this? I don't need backups.. so no
>>>> dump is required....
>>>>
>>>> I have about 600 Gb worth of data.... 99% on the attachments table....
>>>> And want to clean all this up...
>>>>
>>>> There is an answer on the mailling list about this on Jul 13, 2004...
>>>> that simply says that to delete for a giving year do:
>>>>
>>>> rtx-shredder YYYY-MM-DD
>>>>
>>>> But seems to old...
>>>>
>>>> Can you help me? seems like a basic think to do...
>>>>
>>>> Thanks in advance.
>>>>
>>>> Yours trully
>>>>
>>>> *Flávio Moringa*
>>>> Project Leader
>>>>
>>>>
>>>>
>>>> Caixa Mágica Software
>>>> Energia Open Source
>>>> Rua Soeiro Pereira Gomes, Lote 1 - 4.º B,
>>>> Edifício Espanha, 1600-196 Lisboa - Portugal
>>>> Tel.: +351 217 921 260 Fax: +351 217 921 261
>>>> http://www.caixamagica.pt
>>>> https://twitter.com/flaviomoringa
>>>> https://www.facebook.com/flaviomoringa<https://www.facebook.com/flavio.moringa>
>>>> http://pt.linkedin.com/in/flaviomoringa
>>>> http://people.caixamagica.pt/flaviomoringa
>>>>
>>>>
>>>
>>>
>>> --
>>> Bart G.
>>>
>>
>>
>
--
Best regards, Ruslan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20130426/a1e735be/attachment.htm>
More information about the rt-users
mailing list