Operating System - Linux
1755036 Members
3165 Online
108828 Solutions
New Discussion юеВ

howto check if logroate was running successfully ?

 
SOLVED
Go to solution
'chris'
Super Advisor

howto check if logroate was running successfully ?

hi

I have in /etc/cron.daily/

logrotate file with the following entries:
-------------------------------------------------------------
#!/bin/sh

/usr/sbin/logrotate /etc/logrotate.conf
-------------------------------------------------------------

which time exactly, will logrotate start ?

howto check if the last start was successfully ?

kind regards
chris
8 REPLIES 8
Stuart Browne
Honored Contributor
Solution

Re: howto check if logroate was running successfully ?

What does '/etc/crontab' have listed in it?

This should list a line similar to:

25 6 * * * root test -x /usr/sbin/anacron || run-parts --report /etc/cron.daily

(this is from a Woody system). This means the system starts running the jobs in '/etc/cron.daily/' at 6:25a of a morning. As to what time exactally the 'logrotate' gets done is a bit variable, depending on the other jobs in '/etc/cron.daily', but it will be within a few minute sof 6:25a.

In any case, your '/var/log/syslog' should list when cron jobs are triggered.
One long-haired git at your service...
Gopi Sekar
Honored Contributor

Re: howto check if logroate was running successfully ?


your file is in /etc/cron.daily so check up /etc/crontab to find out the time at which cron.daily is scheduled to run.

on my FC4 /etc/crontab entry is:
02 4 * * * root run-parts /etc/cron.daily

which means all the files in /etc/cron.daily will be executed daily at morning 4.20, so check up your system to find out.

if you are not happy to have it run only once in a day then simply remove the logrotate from cron.daily and move it outside and add entry in /etc/crontab to execute it more frequently (at the minimum of once in a minute, or may be at the maximum of once in 4 years)

Hope this helps,
Gopi
Never Never Never Giveup
'chris'
Super Advisor

Re: howto check if logroate was running successfully ?

thanks,

I have on my system in /etc/crontab following entries:

SHELL=/bin/sh
PATH=/usr/bin:/usr/sbin:/sbin:/bin:/usr/lib/news/bin
MAILTO=root
#
# check scripts in cron.hourly, cron.daily, cron.weekly, and cron.monthly
#
-*/15 * * * * root test -x /usr/lib/cron/run-crons && /usr/lib/cron/run-crons >/dev/null 2>&1
59 * * * * root rm -f /var/spool/cron/lastrun/cron.hourly
14 0 * * * root rm -f /var/spool/cron/lastrun/cron.daily
29 0 * * 6 root rm -f /var/spool/cron/lastrun/cron.weekly
44 0 1 * * root rm -f /var/spool/cron/lastrun/cron.monthly

Stuart Browne
Honored Contributor

Re: howto check if logroate was running successfully ?

Alrighty then.. What do you have in '/etc/cron.d/', and what's the output of '/usr/bin/crontab -l' ?
One long-haired git at your service...
Stuart Browne
Honored Contributor

Re: howto check if logroate was running successfully ?

Oh, and are you running both 'cron' and 'anacron'?
One long-haired git at your service...
'chris'
Super Advisor

Re: howto check if logroate was running successfully ?

# cd /etc/cron.d
ext:/etc/cron.d # ls -la
total 16
drwxr-xr-x 2 root root 4096 Mar 30 2004 .
drwxr-xr-x 58 root root 8192 Jul 9 01:26 ..
-rw-r--r-- 1 root root 32 Jan 1 2005 yast2-online-update

# /usr/bin/crontab -l
no crontab for root

what exactly do you mean with 'cron' and 'anacron' ?
Stuart Browne
Honored Contributor

Re: howto check if logroate was running successfully ?

In most linux distributions, there are two cron daemons.

The main one, just 'crond', is a constantly run process which checks the time continually for tasks that need running.

The second one, called 'anacron' which is usually run peridodically from the main 'cron. The purpose of this second cron is to run periodic tasks on machines of which aren't on permenantly (i.e. a normal workstation). It checks if a anacron period has been hit whilst the machine was in a down state, and runs the jobs accordingly.

This cron process uses '/etc/anacrontab' as it's source of jobs.
One long-haired git at your service...
'chris'
Super Advisor

Re: howto check if logroate was running successfully ?

thanks !