Commit 85e08422 authored by mh's avatar mh
Browse files

cleanup as unpriviledged user, as all mod_security logs are anyway written by...

cleanup as unpriviledged user, as all mod_security logs are anyway written by apache & properly cleanup the global path
parent 2bba642f
......@@ -3,10 +3,11 @@
# clean up mod_security log directories that are within
# a certain age
[ -z $1 ] && echo "USAGE: $0 days_to_keep" && exit 1
for vhost in /var/www/vhosts/*/logs /var/lib/mod_security; do
for vhost in /var/www/vhosts/*/logs; do
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
su - apache -s /bin/bash -c "tmpwatch -q ${1}d $vhost/20*"
su - apache -s /bin/bash -c "find $vhost/20* -ignore_readdir_race -maxdepth 1 -mindepth 1 -type d -empty -delete"
su - apache -s /bin/bash -c "find $vhost/20* -ignore_readdir_race -maxdepth 0 -mindepth 0 -type d -empty -delete"
fi
done
su - apache -s /bin/bash -c "tmpwatch -q ${1}d /var/lib/mod_security"
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