$devtoolkit.sh/examples/cron/cleanup

Cron Schedules for Cleanup Jobs

Cleanup jobs prevent disk exhaustion, database bloat, and stale cache buildup that silently degrade performance. These expressions schedule log rotation, temp directory purges, session table pruning, and CDN cache invalidation at off-peak hours. The cron parser shows the next run times so you can ensure cleanups happen often enough to stay ahead of accumulation rates. Always test cleanup scripts on a small subset before scheduling them to run fully unattended.

Example
0 3 * * *
0 4 * * 0
0 1 1 * *
30 2 * * *
0 5 * * 6
*/30 * * * *
0 0 * * *
0 6 1 1 *
[ open in Cron Parser → ]

FAQ

How often should I rotate application logs?
Daily rotation (0 3 * * *) works well for most applications. High-traffic services that generate gigabytes per day may need hourly rotation to keep individual log files manageable.
When should I purge expired sessions from the database?
Run session cleanup during off-peak hours, typically nightly at 2–4 AM. Ensure the cleanup query uses an index on the expiry column to avoid full table scans.
Can I schedule an annual data archive?
Yes. Use 0 6 1 1 * to run once per year on January 1st at 6 AM. Test this job manually before relying on it — an annual schedule is hard to validate automatically.

Related Examples

/examples/cron/cleanupv1.0.0