We need to remove entries on our FreePBX that are older then six month. I found other topics from 2017 but wanted to make sure that this is still the way to go. Can anybody confirm that?
Create a script called (for example) “DeleteCDR8Mos.sql” in your “asterisk root directory” or in the “root” home directory. The example below assumes it’s in the “/root” directory.
use asteriskcdrdb; repair table cdr; repair table cel; delete from cdr where calldate < DATE_SUB(NOW(), INTERVAL 6 MONTH); delete from cel where eventtime < DATE_SUB(NOW(), INTERVAL 6 MONTH); optimize table cdr; optimize table cel; exit;
In your crontab on the server (important part, since access to the database is limited to localhost), add something like:
X X X X X X mysql -u root asteriskcdrdb < /root/DeleteCDR8Mos.sql
The “X” entries are there for your time/date/day entries […]
We are running PBX Firmware: 12.7.6-1904-1.sng7 with PBX Service Pack: 184.108.40.206.