How to fix Log rotate problem in WHM/Cpanel VPS

In this tutorial we will  securing the logrotate, by editing the following file in /etc/cron.daily/logrotate, and use the following code :

#!/bin/sh
export TMPDIR=/var/spool/logrotate/tmp

/usr/sbin/logrotate /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate “ALERT exited abnormally with [$EXITVALUE]”
fi
exit 0

After that, create the folder :

# mkdir -p /var/spool/logrotate/tmp

Leave a Reply

Your email address will not be published. Required fields are marked *