I need to be able to rotate cron.daily on OpenSUSE 10.3 at 2315 hours every night. This is because I need to rotate my apache logs (via logrotate) at that time.
At the moment my apache logs are rotating at various different time (I guess via cron.daily).
In my root’s crontab I have put
0 23 * * * rm -f /var/spool/cron/lastrun/cron.daily
since I have read somewhere that cron.daily will start 15 minutes after I delete this file. But logs are still rotated around 1600.
cat /etc/cron.daily/logrotate
#!/bin/sh
TMPF=
mktemp /tmp/logrotate.XXXXXXXXXX
/usr/sbin/logrotate /etc/logrotate.conf 2>&1 | tee $TMPF
EXITVALUE=${PIPESTATUS[0]}if $EXITVALUE != 0 ]; then
# wait a sec, we might just have restarted syslog
sleep 1
# tell what went wrong
/bin/logger -t logrotate “ALERT exited abnormally with $EXITVALUE]”
/bin/logger -t logrotate -f $TMPF
firm -f $TMPF
exit 0
cat /etc/logrotate.conf
weekly
rotate 4
create
dateext
compresscmd /usr/bin/bzip2
uncompresscmd /usr/bin/bunzip2
include /etc/logrotate.d
cat /etc/logrotate.d/apache2
/var/log/apache2/access_log {
compress
dateext
maxage 365
rotate 99
size=+4096k
notifempty
missingok
create 644 root root
postrotate
/etc/init.d/apache2 reload
endscript
}/var/log/apache2/error_log {
compress
dateext
maxage 365
rotate 99
size=+1024k
notifempty
missingok
create 644 root root
postrotate
/etc/init.d/apache2 reload
endscript
}/var/log/apache2/ssl-request_log {
dateext
maxage 365
missingok
create 644 root root
postrotate
/etc/init.d/apache2 reload
endscript
Thanks for any help.