[thelist] help with logrotate...please

Jake Aust mail_lists at jakesdiner.com
Mon Apr 29 11:11:01 CDT 2002


I added the /bin/touch lines to my script and they both work. The user and
group on the "foo.test" files is root so there should be no permissions
problems.

But the line:

/bin/mv /home/virtual/lovejoyc/var/log/httpd/access_log.1.gz
/home/virtual/lovejoyc/var/log/httpd/access_log.`date '+%Y-%m-%d'`.gz

simply does nothing.

I can't figure it out and I'm sure it's something stupid that I'm doing
wrong.



On 4/25/02 6:40 AM, "Hassan Schroeder" <hassan at webtuitive.com> wrote:

> Jake Aust wrote:
>
>> It works on the command line, but not in the script.
>
> Ah, that famous complaint above usually indicates a problem with
> either path or permissions.
>
> Make sure all paths are explicit ("/bin/mv" instead of "mv"); the
> entity running the script may not have the same PATH as you do (or
> any PATH at all, for that matter).
>
> Make sure the entity running the script has appropriate permissions
> on the relevant directory/file. You can determine that entity, and
> whether it has write permission in your log directory, by inserting
> a line in your script like
>
> /bin/touch /tmp/foo.test
> /bin/touch /home/virtual/lovejoyc/var/log/foo.test
>
> If the script is run, the first line should create a file named
> foo.test in /tmp, a directory that's globally writable. If it's
> created, an `ls -l /tmp/foo.test' will show you "who" created it.
>
> If the second line fails, you have a perms problem; that entity
> doesn't have write permission in your log directory, and so can't
> rename the log files.
>
> HTH,
> --
> H*
> Hassan Schroeder ----------------------------- hassan at webtuitive.com
> Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
>
>   -- creating dynamic Web sites and applications since 1994 --





>> I am having a heck of a time with logrotate on my Linux web server.
>>
>> I am trying to get my logs to be renamed with the date added after they've
>> been rotated. Here is my logrotate.d/apache file
>>
>> --------------------------------------------------------
>> /home/virtual/lovejoyc/var/log/httpd/access_log {
>>   daily
>>   rotate 365
>>   missingok
>>   postrotate
>>       mv /home/virtual/lovejoyc/var/log/httpd/access_log.1.gz
>> /home/virtual/lovejoyc/var/log/httpd/access_log.`date '+%Y-%m-%d'`.gz
>>       /usr/bin/killall -HUP httpd
>>   endscript
>> --------------------------------------------------------
>>
>>
>>
>> It just doesn't rename my file. I end up with the same old format:
>> "access_log.1.gz"
>>
>> It works on the command line, but not in the script. What am I doing wrong?
>>
>> I want to have logfiles that look like this:
>>
>> access_log.2002-04-24.gz
>> access_log.2002-04-25.gz
>> etc.
>>
>>
>> Jake Aust




More information about the thelist mailing list