[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Logrotate failing for apache logs



Malcolm Ferguson <Malcolm_Ferguson@yahoo.com> writes:

> I've just rebuild my server and now it appears that logrotate is
> failing for apache:
>
> wolverine:/var/log# logrotate /etc/logrotate.d/apache
> error running shared postrotate script for /var/log/apache/*.log
>
> I've run the above command through strace and it looks like logrotate
> creates a file in /tmp and writes out a shell script to restart
> apache.  I've tried recreating the script by hand and executing it
> from the command line, and it appears to work (echo $? displays 0).
> So what could be wrong?
> Relevant part of strace's output:
>
> open("/tmp/logrotate.97X4bM", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600) = 3
> fchmod(3, 0700)                         = 0
> write(3, "#!/bin/sh\n\n", 11)           = 11
> write(3, "\n\t\t/etc/init.d/apache reload > /"..., 41) = 41
> close(3)                                = 0
> rt_sigaction(SIGINT, {SIG_IGN}, {SIG_DFL}, 8) = 0
> rt_sigaction(SIGQUIT, {SIG_IGN}, {SIG_DFL}, 8) = 0
> rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
> fork()                                  = 15909
> wait4(15909, [WIFEXITED(s) && WEXITSTATUS(s) == 1], 0, NULL) = 15909
> rt_sigaction(SIGINT, {SIG_DFL}, NULL, 8) = 0
> rt_sigaction(SIGQUIT, {SIG_DFL}, NULL, 8) = 0
> rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
> --- SIGCHLD (Child exited) ---
> unlink("/tmp/logrotate.97X4bM")         = 0
> write(2, "error running shared postrotate "..., 66error running shared
> postrotate script for /var/log/apache/*.log
> ) = 66

Hmmm, looks like the error is occuring in the forked process, which
presumably tries to exec the script. Try strace -f to follow children
and see whether it's telling more ...

Regards, Bruno.



Reply to: