Select Page

Sometimes on cPanel/WHM the php user logs get large and/or might not get rotated properly. This script should take care of this

nano /root/logs.clear.sh

paste the contents below

chmod 700 logs.clear.sh

./root/logs.clear.sh

#!/bin/bash -x
for i in $(ls /var/cpanel/users)
do
cd /home/${i}/logs && find . -type f -name “*.php.error.log” -print0 | xargs -0 -I{} sh -c ‘echo “” > “{}”‘\;
done

Pin It on Pinterest