Schedule weekly database auto cleanup

To set up automatic database cleanup, we use the embedded Linux tool - crontab.

To do that, run the following command:

sudo crontab -e

Input the following text in the new line:

0 1 * * 7 sudo staffcop cleanup 100 >> /srv/cleanupdb.log

Each Sunday at 1 AM (server local time) all the events older than 100 days will be erased and the operation log will be added to file “/srv/cleanupdb.log

Note

To reach the maximum performance of the database cleanup mechanism, provide the free space according to the formula: free space = database size / 8.