Re: Logrotate weekly prerotate everyday?
> Hello Folks: > > I call a local script from... > > /etc/logrotate.d/apache > > ...in Debian 3.0 to run Analog reports. It is supposed to run once a > week, but it runs every day: It seems that the "sharedscripts" causes this: with "sharedscript" the prerotate script is always executed (logrotate 3.5.9). In fact if I use "nosharedscripts" the prerotate is executed only if a log file is actually rotated, but it is executed once for each rotation. It is somewhat understandable, but when the rotation involves several log files, I think it is more desiderable to exec prerotate if and only if one of the log files need rotation? My be... -- Niccolo Rigacci http://www.texnet.it/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Logrotate weekly prerotate everyday?
On Sat, 03 Aug 2002 at 9:13:50 -0700, Ward Willats wrote: > Hello Folks: > > I call a local script from... > > /etc/logrotate.d/apache > > ...in Debian 3.0 to run Analog reports. It is supposed to run once a > week, but it runs every day: > >/var/log/apache/*.log { >weekly >missingok >rotate 52 >compress >delaycompress >notifempty >create 640 root adm >sharedscripts >postrotate >/etc/init.d/apache reload > /dev/null >endscript ># -- added by ward 28Jul02 >prerotate >/etc/run_weekly_analog_reports.sh >endscript ># -- end ward >} > > My tiny mind thinks a "prerotate" block should only be executed > "weekly" once it has been decided to perform a rotation. Not every > time cron/logrotate peeks into this "apache" file. What as I missing? > > (I have fixed the problem by checking the day of the week in my local > reporting script, but I'd still like to understand my disconnect with > Perfect Understanding of the One True Way(tm).) > I'm going to write not a solution of your particular problem with logrotate but a tip for "bypassing" it. I don't know why your "prerotate" section is executed daily instead of weekly; I don't use any "prerotate" blocks but a few "postrotate" ones work OK for me, i.e. "weekly" are executed weekly, not daily. Anyway, if logrotate doesn't work properly for you, you can use ordinary crontab entry, scheduled some time (e.g. 10 or 15 minutes to be sure) _after_ the time your weekly rotation goes on. This way you have to process already rotated logs (probably with suffix .1). End even better: create separate, unprivileged user just for Analog processing (you will have to arrange permissions so that this user has got read access to logs and write access to resulting Analog files). The less programs running as root, the better. And just purity remark (as you care for "True Way", which is a good thing :-) ): don't put your home-brewed programs or scripts in /etc/. This is not a place for them. They should be in /usr/local/bin (or sbin). Hope this helps -- Tomasz Papszun SysAdm @ TP S.A. Lodz, Poland | And it's only [EMAIL PROTECTED] http://www.lodz.tpsa.pl/ | ones and zeros.
Re: Logrotate weekly prerotate everyday?
On Sat, 3 Aug 2002, Ward Willats wrote: > ...in Debian 3.0 to run Analog reports. It is supposed to run once a > week, but it runs every day: > My tiny mind thinks a "prerotate" block should only be executed > "weekly" once it has been decided to perform a rotation. Not every > time cron/logrotate peeks into this "apache" file. What as I missing? I have same issue (on a Red Hat Linux box) that I just noticed earlier this morning. (Well worse: mine runs "postrotate" everyday too.) My /etc/logrotate.d/apache also is set for weekly (and the logs are rotated correctly every Sunday at 4:00). But it always runs the postrotate commands everyday at 4:00 too. (Sorry this is not Debian-specific. This is logrotate-3.5.4-1 RPM.) I'll have to look at this further ... Jeremy C. Reed echo 'G014AE824B0-07CC?/JJFFFI?D64CB>D=3C427=>;>6HI2>
RE: Logrotate weekly prerotate everyday?
At least yours runs. I finally gave up and wrote a perl script to rotate mine. ugh Sincerely, Daniel J. Rychlik " Money does not make the world go round , Gravity does ." -Original Message- From: Ward Willats [mailto:[EMAIL PROTECTED] Sent: Saturday, August 03, 2002 11:14 AM To: debian-isp@lists.debian.org Subject: Logrotate weekly prerotate everyday? Hello Folks: I call a local script from... /etc/logrotate.d/apache ...in Debian 3.0 to run Analog reports. It is supposed to run once a week, but it runs every day: /var/log/apache/*.log { weekly missingok rotate 52 compress delaycompress notifempty create 640 root adm sharedscripts postrotate /etc/init.d/apache reload > /dev/null endscript # -- added by ward 28Jul02 prerotate /etc/run_weekly_analog_reports.sh endscript # -- end ward } My tiny mind thinks a "prerotate" block should only be executed "weekly" once it has been decided to perform a rotation. Not every time cron/logrotate peeks into this "apache" file. What as I missing? (I have fixed the problem by checking the day of the week in my local reporting script, but I'd still like to understand my disconnect with Perfect Understanding of the One True Way(tm).) Thanks, -- Ward -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]