Hosting Articles Technical Articles

How To Sortout etc/cron.daily/logrotate for /tmp noexec workaround

How To Sortout etc/cron.daily/logrotate for /tmp noexec workaround

Issue:

etc/cron.daily/logrotate for /tmp noexec workaround gives warning in ConfigServer Security&Firewall.

It is Giving the below Warning

Due to a bug in logrotate if /tmp is mounted with the noexec option, you need to have logrotate use a different temporary directory. If you don’t do this syslog may not restart correctly and will write to the wrong (older) log files. See here for a way to do this

Solution:

Log in to The server.

Go to the below path.

-nano /etc/cron.daily/logrotate

-File content should be like this after modification.

#!/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

-Ctrls+x and save the file.

-Now Create a directory as follows.

mkdir -p /var/spool/logrotate/tmp

Tags:WHm,Capnel,Linux,Centos server,Firewall,CSF,Cpanel Firewall..