LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   RHEL 5.* logfiles (https://www.linuxquestions.org/questions/linux-newbie-8/rhel-5-%2A-logfiles-750097/)

MeeLee 08-25-2009 07:46 AM

RHEL 5.* logfiles
 
How do you check what time the logfiles run?

I can see in:

/etc/logrotate.conf

that they are daily, and in:

/etc/logrotate.d

who is being rotated...

but is there a way to tell what time they will run? Is it just a default of midnight? How can you tell?

How would I go about setting them so that the rotated at, say 3am in the morning?

Many Thanks in advance,

Lee

colucix 08-25-2009 07:54 AM

You can see the time at which the logrotate script is executed by looking at /etc/crontab. For example on my RHEL4 system I have:
Code:

$ 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

As you can see the daily job is executed at 4:02 AM. This is confirmed by the cron log:
Code:

$ grep daily /var/log/cron
Aug 24 04:02:01 server crond[23584]: (root) CMD (run-parts /etc/cron.daily)
Aug 24 04:02:04 server anacron[23991]: Updated timestamp for job `cron.daily' to 2009-08-24
Aug 25 04:02:01 server crond[25136]: (root) CMD (run-parts /etc/cron.daily)
Aug 25 04:02:04 server anacron[25563]: Updated timestamp for job `cron.daily' to 2009-08-25

You can change the time in /etc/crontab if you have root privileges.

fordeck 08-25-2009 07:58 AM

You can see what time they run by looking at the contents of the following file:

/etc/crontab

For example you could run the following command:

Code:

[root@fs2 etc]# cat 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

Usually the logrotate script is run with the 'cron.daily'

Regards,

Fordeck

MeeLee 08-25-2009 09:15 AM

Thank you both! :D


All times are GMT -5. The time now is 01:10 AM.