# Clean database from old entries with command line

**URL:** https://forum.mautic.org/t/clean-database-from-old-entries-with-command-line/23108
**Category:** Ideas and Feature Requests
**Created:** [March 17, 2022, 6:09pm UTC](https://forum.mautic.org/t/clean-database-from-old-entries-with-command-line/23108 "2022-03-17T18:09:32Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![pierre\_a](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/pierre_a/32/7031_2.png) [@pierre\_a](https://forum.mautic.org/u/pierre_a)
#### Post date: [March 17, 2022, 6:09pm UTC](https://forum.mautic.org/t/clean-database-from-old-entries-with-command-line/23108/1 "2022-03-17T18:09:32Z")

</div>

Hello,

My idea would be to add a command line to clean the database of old entries.  
This would be useful in the case of Mautic instance with a lot of contacts, a lot of campaigns and a lot of JS tracker calls.

What do you think about this?

Pierre

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [March 18, 2022, 8:53am UTC](https://forum.mautic.org/t/clean-database-from-old-entries-with-command-line/23108/2 "2022-03-18T08:53:22Z")

</div>

Hi,  
check this:

> <https://gist.github.com/sebastian-fahrenkrog/0d53ced6a50ed680383f4680c6398635>

---

<div class="post-metadata">

### Author: ![pierre\_a](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/pierre_a/32/7031_2.png) [@pierre\_a](https://forum.mautic.org/u/pierre_a)
#### Post date: [March 18, 2022, 9:15am UTC](https://forum.mautic.org/t/clean-database-from-old-entries-with-command-line/23108/3 "2022-03-18T09:15:35Z")

</div>

Hello @joeyk,

I know this set of rules. I already apply some of them.  
I propose to put this in the form of a script that can be triggered via a CRON job.

What do you think?

Pierre

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [March 18, 2022, 12:01pm UTC](https://forum.mautic.org/t/clean-database-from-old-entries-with-command-line/23108/4 "2022-03-18T12:01:33Z")

</div>

Hello @pierre_a ,  
You can already add these scripts to your cron.  
Add timing in front and go.
