Created
November 10, 2015 13:13
-
-
Save versvs/2c65062e11f6852b8afb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# old-files.sh - Borrado sessiones de XXXX para XXXX. | |
# | |
# Añadido por Cartograf XXXX-XX-XX, añadido en user XXXX por limpieza | |
# y organizacion | |
# | |
# Debemos añadir el fichero a cron (/etc/cron.d/old-files, o similar) | |
# | |
# --------------------------------------------------- | |
# Cron para backups | |
# | |
# m h dom mon dow user command | |
# 0 1 * * * root /home/user/scripts/old-files.sh | |
# | |
# --------------------------------------------------- | |
# | |
# move to the backups folder | |
cd /path/to/backups/folder/ | |
# find old backups and delete them. leave 8 days of backups (7 + 1, due to mtime behaviour) | |
find . -mtime +7 -exec rm -f {} \; | |
# as everyday has its folder to store backups, delete just emptied directories | |
find . -empty -type d -delete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment