Re: [wallfire-users] wflogs_report error when run from cron.daily
Brought to you by:
eychenne
|
From: wolvie.news <wol...@wp...> - 2005-03-10 09:05:10
|
W liście z pon, 28-02-2005, godz. 17:00, Herve Eychenne pisze: > On Mon, Feb 28, 2005 at 05:51:54PM +0100, wolvie.news wrote: > > Hi, > > > I've encountered a problem running the J.M. Kelbert's wflogs_report > > script from the cron.daily crontask. I get the following error e-mail > > message: > > > > Subject: Cron <root@core> test -x /usr/sbin/anacron || run-parts > > --report > > +/etc/cron.daily > > > /etc/cron.daily/wflogs_report: > > error before `[': syntax error > > wflogs: Error: wrong filter expression. > > run-parts: /etc/cron.daily/wflogs_report exited with return code > > 1 > > > > and empty file in /var/www/yyyy/mm/ directory. > > I'm running wflogs on my sarge machine installed via the apt-get > > command. Since I'm a rookie I cannot find the solution to the problem. > > Running the same script from bash shell and from the root's crontab file > > is fine. > > > > Thanks in advance for any hints/solutions. > > Yes, we are aware of that. This error seems to show up in a unpredictable > way, so it happens from time to time. I guess it's a quoting problem in > the script, but I couldn't figure out what causes this exactly, nor trigger > it in a reproductible way. > > Well... I guess the "best" solution is to add "set -x" at the begining of the > script, and wait for the error to occur again. > Feel free to do that and report the detailed error dump when you'lle face > this bug again. > I'll probably do the same on my machine. > Cheers, > > Herve > > -- > _ > ( = Herve Eychenne > //) > v_/_ WallFire project: http://www.wallfire.org/ > I've done so research and here are the results: Firstly I wrote a script generating a report on hourly basis (via cron.hourly) which was supposed to overwrite a file with a -24h report . Similar errors occured from time to time. I thought it was a cron/bash env/locales error (parsing a date) but after doing some dumps I knew I was wrong. Secondly I did some dumps (echo $whatever_might_be_wrong) in an oryginal /etc/cron.daily/wflogs_report script (still thinking it was a problem related to date localisation). What I had to do next was to wait and read the mail. And it hit me today: The date looks ok. The file is generated although it's empty. And the filter expression is somehow wrong. I took a look at the logs and compared the timestamps of lines in logs with the time of running wflogs_report. And... there is no error. DATE_BEGIN_LOG=`head -n 1 $INPUT_FILE | awk '{print $1,$2}'` does it's job.. or doesn't it? :) Example: MAIL FROM CRON: /etc/cron.daily/wflogs_report: Running /etc/cron.daily/wflogs_report (...) export LC_ALL="C" set. Date looks like this: Thu Mar 10 06:27:37 CET 2005 (...) __MARK__ Dumping FILTER: $start_time >= [] && $start_time < [ 1 day] error before `[': syntax error wflogs: Error: wrong filter expression. run-parts: /etc/cron.daily/wflogs_report exited with return code 1 KERN.LOG.0 ends with: Mar 10 06:26:42 localhost kernel: blah... (after logrotate) KERN.LOG starts with: Mar 10 06:28:06 localhost kernel: blah... So at 06:27:37 kern.log is empty (or I'm wrong). Can this be considered an bug? Howto fix this not complicating the whole script too much? Concatenating the INPUT_FILE* files into some temp file? Maybe... The problem is that even if wflogs doesn't hit the exact time of log rotation it still will not give the full daily report. Hope this was somehow helpful and my deduction was right. -- Lukasz Kusmirek wolvie<dot>news<at>wp<dot>pl |