Skip to content

Instantly share code, notes, and snippets.

@rushipkar90
Created September 25, 2015 16:32
Show Gist options
  • Save rushipkar90/c8e94c478b15c019f25a to your computer and use it in GitHub Desktop.
Save rushipkar90/c8e94c478b15c019f25a to your computer and use it in GitHub Desktop.
find150.sh
#!/bin/sh
# Directory to store log files in
DST=/root/logs
# Any logs older than this will be deleted first
KEEPDAYS=14
# Create DST if it doesn't exist
if [ ! -d "$DST" ]; then
mkdir $DST
fi
# Remove logs older than KEEPDAYS in DST
find ${DST} -type f -mtime +${KEEPDAYS} -exec rm -f {} \;
# Find files over 150MB
find /home -type f -size +150000 > ${DST}/files_over150M-`date +%F`.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment