A Cleaning up LOG and IMAGES directory - moudsen/mailGraph GitHub Wiki
v2.02 introduces the parameter "cleanup" for mailGraph.php to assist in cleaning up the LOG and IMAGES directories.
Configuration By default the following cleanup values are used:
- Retention period for LOG files (./log/*dump): 14 days
- Retention period for IMAGE files (./images/*png): 30 days
You can set your own values in ./config/config.json:
- "retention_logs":
- "retention_images":
Invocation Please make sure you invoke the cleanup with the working directory set to the directory that contains mailGraph.php. Usage from cron:
15 0 * * * /usr/local/bin/cleanupMailGraph
For this to work create /usr/local/bin/cleanupMailGraph
#!/bin/bash
cd /var/www/vhosts/<host directory of mailGraph.php>
php mailGraph.php cleanup
and allow for execution:
chmod +x /usr/local/bin/cleanupMailGraph
Notes
- There is no "test" hence make sure that you invoke the cleanup with your expected retention configuration before executing as otherwise the default values will be applied.