Re: Newsyslog | Cronjob faulty? (fwd)

2012-05-27 Thread Ian Smith
Jos, did you not get my response to your original query over a week ago?

I see it made the list archives.  Anyway this second time around, Robert 
Bonomi wins gold for the best guess, with even fewer clues to go on :-)

cheers, Ian  (who probably said too much, but doesn't resile)

-- Forwarded message --
Date: Sat, 19 May 2012 05:03:23 +1000 (EST)
From: Ian Smith smi...@nimnet.asn.au
To: Jos Chrispijn ker...@webrz.net
Cc: freebsd-questions@freebsd.org
Subject: Re: Newsyslog | Cronjob faulty?

In freebsd-questions Digest, Vol 415, Issue 4, Message: 12
On Wed, 16 May 2012 21:44:53 +0200 Jos Chrispijn ker...@webrz.net wrote:

  At midnight (00.00) I run this cronjob from my crontab:
  
  Crontab:
  00  *   *   *   *   rootnewsyslog

By 'my' crontab, do you mean the system crontab, /etc/crontab ?

If so, that's nearly but not quite the default syntax of:

#minute hourmdaymonth   wdaywho command
# Rotate log files every hour, if necessary.
0   *   *   *   *   rootnewsyslog

Note the single '0'.  I don't know if '00' is valid.  And it doesn't 
mean 'at midnight', it means whenever the minute is 0, any hour, any 
day, any month, any weekday; ie newsyslog is run hourly, on the hour.

And the default entry in /etc/newsyslog.conf for maillog is:

/var/log/maillog640  7 *@T00  JC

So it's newsyslog using newsyslog.conf(5) that creates maillog if it 
doesn't yet exist, rotates it to maillog.0 at midnight (T00), thereafter
compressing it with bzip2 (J).

  For some reason this goes wrong; (if I run 'newsyslog' on any other 
  time, there is no error message).
  
  bzip2: Can't open input file /var/log/maillog.0: No such file or directory.
  newsyslog: `bzip2 -f /var/log/maillog.0' terminated with a non-zero 
  status (1)
  
  /var/log:
  -rw-r-  1 rootwheel 63162 May 16 21:20 maillog
  -rw-r-  1 rootwheel   109 May 16 00:00 maillog.0.bz2
  -rw-r-  1 rootwheel 73674 May 16 00:00 maillog.1
  -rw-r-  1 rootwheel   111 May 15 00:00 maillog.2.bz2
  -rw-r-  1 rootwheel 73050 May 15 00:00 maillog.3
  -rw-r-  1 rootwheel   109 May 14 00:00 maillog.4.bz2
  -rw-r-  1 rootwheel184042 May 14 00:00 maillog.5
  
  Can somebody tell me what goes wrong here?

Looks likely two instances of newsyslog racing at midnight; one makes 
maillog.0.bz2 from the just-rolled maillog.0, the other finds maillog.0 
has disappeared before getting to run bzip2 on it?  So, two files per 
day, and the above message?

  On my other FreeBSD server the same cronjob goes ok...

Check /etc/crontab and /etc/newsyslog.conf on both, and make sure you're 
not also trying to run a user crontab for root, apart from /etc/crontab?

cheers, Ian
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Newsyslog | Cronjob faulty?

2012-05-18 Thread Ian Smith
In freebsd-questions Digest, Vol 415, Issue 4, Message: 12
On Wed, 16 May 2012 21:44:53 +0200 Jos Chrispijn ker...@webrz.net wrote:

  At midnight (00.00) I run this cronjob from my crontab:
  
  Crontab:
  00  *   *   *   *   rootnewsyslog

By 'my' crontab, do you mean the system crontab, /etc/crontab ?

If so, that's nearly but not quite the default syntax of:

#minute hourmdaymonth   wdaywho command
# Rotate log files every hour, if necessary.
0   *   *   *   *   rootnewsyslog

Note the single '0'.  I don't know if '00' is valid.  And it doesn't 
mean 'at midnight', it means whenever the minute is 0, any hour, any 
day, any month, any weekday; ie newsyslog is run hourly, on the hour.

And the default entry in /etc/newsyslog.conf for maillog is:

/var/log/maillog640  7 *@T00  JC

So it's newsyslog using newsyslog.conf(5) that creates maillog if it 
doesn't yet exist, rotates it to maillog.0 at midnight (T00), thereafter
compressing it with bzip2 (J).

  For some reason this goes wrong; (if I run 'newsyslog' on any other 
  time, there is no error message).
  
  bzip2: Can't open input file /var/log/maillog.0: No such file or directory.
  newsyslog: `bzip2 -f /var/log/maillog.0' terminated with a non-zero 
  status (1)
  
  /var/log:
  -rw-r-  1 rootwheel 63162 May 16 21:20 maillog
  -rw-r-  1 rootwheel   109 May 16 00:00 maillog.0.bz2
  -rw-r-  1 rootwheel 73674 May 16 00:00 maillog.1
  -rw-r-  1 rootwheel   111 May 15 00:00 maillog.2.bz2
  -rw-r-  1 rootwheel 73050 May 15 00:00 maillog.3
  -rw-r-  1 rootwheel   109 May 14 00:00 maillog.4.bz2
  -rw-r-  1 rootwheel184042 May 14 00:00 maillog.5
  
  Can somebody tell me what goes wrong here?

Looks likely two instances of newsyslog racing at midnight; one makes 
maillog.0.bz2 from the just-rolled maillog.0, the other finds maillog.0 
has disappeared before getting to run bzip2 on it?  So, two files per 
day, and the above message?

  On my other FreeBSD server the same cronjob goes ok...

Check /etc/crontab and /etc/newsyslog.conf on both, and make sure you're 
not also trying to run a user crontab for root, apart from /etc/crontab?

cheers, Ian
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Newsyslog | Cronjob faulty?

2012-05-16 Thread Jos Chrispijn

At midnight (00.00) I run this cronjob from my crontab:

Crontab:
00  *   *   *   *   rootnewsyslog

For some reason this goes wrong; (if I run 'newsyslog' on any other 
time, there is no error message).


bzip2: Can't open input file /var/log/maillog.0: No such file or directory.
newsyslog: `bzip2 -f /var/log/maillog.0' terminated with a non-zero 
status (1)


/var/log:
-rw-r-  1 rootwheel 63162 May 16 21:20 maillog
-rw-r-  1 rootwheel   109 May 16 00:00 maillog.0.bz2
-rw-r-  1 rootwheel 73674 May 16 00:00 maillog.1
-rw-r-  1 rootwheel   111 May 15 00:00 maillog.2.bz2
-rw-r-  1 rootwheel 73050 May 15 00:00 maillog.3
-rw-r-  1 rootwheel   109 May 14 00:00 maillog.4.bz2
-rw-r-  1 rootwheel184042 May 14 00:00 maillog.5

Can somebody tell me what goes wrong here?
On my other FreeBSD server the same cronjob goes ok...

thanks,
Jos Chrispijn
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org