Commit fb46d10d authored by mh's avatar mh
Browse files

an improved cleanup script

parent e5ad5b67
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
# clean up mod_security log directories that are within # clean up mod_security log directories that are within
# a certain age # a certain age
[ -z $1 ] && echo "USAGE: $0 days_to_keep" && exit 1 [ -z $1 ] && echo "USAGE: $0 days_to_keep" && exit 1
ls -d /var/www/vhosts/*/logs 2>/dev/null | while read logdir; do for vhost in /var/www/vhosts/*/logs; do
find $logdir -mindepth 1 -maxdepth 1 -type d -mtime +${1} -print0 | xargs -0 rm -rf if ls $vhost/20* 1> /dev/null 2>&1; then
tmpwatch -q ${1}d $vhost/20*
find $vhost/20* -ignore_readdir_race -maxdepth 1 -mindepth 1 -type d -empty -delete
find $vhost/20* -ignore_readdir_race -maxdepth 0 -mindepth 0 -type d -empty -delete
fi
done done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment