As root crontab -e and add:

4 12 * * * /usr/bin/find /backup/20* -mtime +30 -delete

Explanation:

    • 4 12 5 * * At 12:04pm on the 5th of every month
    • /usr/bin/find /backup/20* Find directories in /backup/ that begin with “20” (like “2017-03-20”)
    • -mtime +30 Where the “make time” is greater than 30 days ago
    • -delete So long, farewell, auf wiedersehen, goodbye!

Leave a Reply

Your email address will not be published. Required fields are marked *