cron usage and squid daily log rotate

a bv vbavbalist at gmail.com
Mon Mar 2 20:27:47 UTC 2009


Thank you very much,

But what all these mean one by one? weekly tells it self (what needed
is daily logs so will change the weekly to daily) but what about the
other lines and  what about my log files are not at the default path?
Is there something to care /change at squid.conf for this log rotation
thing?

weekly
   rotate 5
   copytruncate
   compress
   notifempty
   missingok

Regards

2009/3/2 Harry Hoffman <hhoffman at ip-solutions.net>:
> This is all documented very nicely in the cron manpage:
>
> $man cron
> Cron should be started from /etc/rc.d/init.d or /etc/init.d
>
> Cron  searches  /var/spool/cron for crontab files which are named after
> accounts in crontabs found are loaded into memory.
> Cron also  searches for /etc/crontab and the files in the directory,
> which are in a different format (see crontab(5) ).  Cron then wakes up
> every minute, examining  all  stored crontabs, checking each command to
> see if it should be run in the current minute.  When  executing
> commands, any  output  is mailed  to the owner of the crontab (or to the
> user named in the MAILTO environment variable in the crontab, if such
> exists).
>
> If we look at /etc/crontab we see how each of the
> cron.{hourly,daily,weekly,monthly} crontabs are executed:
>
> $cat /etc/crontab
> SHELL=/bin/bash
> PATH=/sbin:/bin:/usr/sbin:/usr/bin
> MAILTO=root
> HOME=/
>
> # run-parts
> 01 * * * * root run-parts /etc/cron.hourly
> 02 4 * * * root run-parts /etc/cron.daily
> 22 4 * * 0 root run-parts /etc/cron.weekly
> 42 4 1 * * root run-parts /etc/cron.monthly
>
> And if we look at the file in /etc/cron.daily we see a crontab for
> logrotate.
>
> Because cron.daily is run every morning at 4:02am we can expect
> logrotate to run around that time.
>
>
> The logrotate script say to move the squid log files out of the way
> /var/log/squid/access.log {
>    weekly
>    rotate 5
>    copytruncate
>    compress
>    notifempty
>    missingok
> }
> ... <snipped other logfile entries>
>
> /var/log/squid/store.log {
>    weekly
>    rotate 5
>    copytruncate
>    compress
>    notifempty
>    missingok
> # This script asks squid to rotate its logs on its own.
> # Restarting squid is a long process and it is not worth
> # doing it just to rotate logs
>    postrotate
>      /usr/sbin/squid -k rotate
>    endscript
> }
>
> The final logrotate statement above tells squid to rotate the log files:
> /usr/sbin/squid -k rotate
>
>
> For other ways of rotating the logs the Squid FAQ is indespensible:
> http://wiki.squid-cache.org/SquidFaq/SquidLogs#head-df8a4e31ffc62c98268eb3e7774f7c4f0735fac9
>
> and/or here:
>
> http://docstore.mik.ua/squid/FAQ-6.html
>
>
> HTH.
>
> Cheers,
> Harry
>
>
> On Mon, 2009-03-02 at 10:24 +0200, a bv wrote:
>> Hi all,
>>
>> I would like to daily logrotate the squid log files at everyday at
>> 00:00(midnight) at some RHEL 5.x systems. I havent used cron things
>> for a long time so i forgot all about it. Also i have the
>> logrotate.conf  and /etc/logrotate.d/squid file.
>>
>> i have tried to add a /usr../sbin/rotate -k thing as a cron job but it
>> seem to be unsuccessfull.  Googling makes some mind mixing samples
>> etc. also using crontab -e command brings an empty file, other than
>> the one i find crontab.
>>
>> So is there someone who will shortly explain the cron related files
>> and usage , also making the squid rotate its daily logs easily.   Most
>> of the resources (including books) makes confusing the minds at these
>> simple subjects. Couldnt see  a step by step guide.
>>
>> Regards
>>
>
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
>




More information about the redhat-list mailing list