Skip to content

Instantly share code, notes, and snippets.

@gabrielkfr
Last active December 21, 2015 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielkfr/6314901 to your computer and use it in GitHub Desktop.
Save gabrielkfr/6314901 to your computer and use it in GitHub Desktop.
Script para eliminar archivos por antigüedad.
#!/bin/bash
# Variables
# OBS VARIABLE FILES_LIFE_TIME: Cuando el valor es 1, los archivos a
# ser eliminados son los que tienen una antiguedad mayor a 48 horas,
# si el valor de la variable es 2, los archivos que seran eliminados
# seran aquellos con una antiguedad mayor a 72 horas, y si por ejemplo
# el valor de la variable es cero 0, los archivos eliminados seran
# aquellos cuya antiguedad sea mayor a 24 horas en existencia.
PATH_ARCHIVES_LOCAL=/backups
FILES_LIFE_TIME=2
# Ejecucion del comando de limpieza
find $PATH_ARCHIVES_LOCAL/*.arc -mtime +$FILES_LIFE_TIME -exec rm {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment