R flag in newsyslog works incorrect

Ilya A. Arkhipov ruM1cRO at yandex.ru
Sat Jul 7 12:08:20 UTC 2012


Hi All,

Looks as R flag with archiving works incorrect, for example:
root at mhome:/tmp/test# less nsl.cfg 
/tmp/test/test.log      micro:wheel     640     20      10      *       BZR     /tmp/test/test.sh
root at mhome:/tmp/test# less test.sh 
echo atata

root at mhome:/tmp/test# newsyslog -vF -f nsl.cfg 
Processing nsl.cfg
/tmp/test/test.log <20Z>: size (Kb): 1 [10] --> trimming log....
Signal all daemon process(es)...
Run command: /tmp/test/test.sh 1
atata
Pause 10 seconds to allow daemon(s) to close log file(s)
Compress all rotated log file(s)...
newsyslog: log /tmp/test/test.log.0 not compressed because daemon(s) not notified

http://micro.heavennet.ru/patch/newsyslog.patch fix it.

root at mhome:/tmp/test# newsyslog -vF -f nsl.cfg 
Processing nsl.cfg
/tmp/test/test.log <20Z>: size (Kb): 68 [10] --> trimming log....
Signal all daemon process(es)...
Run command: /tmp/test/test.sh 1
atata
Pause 10 seconds to allow daemon(s) to close log file(s)
Compress all rotated log file(s)...

Could you please review and fix it.

Thanks in advance!

-- 
With Best Regards,
Ilya A. Arkhipov
-------------- next part --------------
--- newsyslog.c_old	2012-07-07 14:49:41.502135608 +0000
+++ newsyslog.c	2012-07-07 14:48:09.425136998 +0000
@@ -1972,7 +1972,7 @@
 	else
 		pgm_name++;
 
-	if (zwork->zw_swork != NULL && zwork->zw_swork->sw_pidok <= 0) {
+	if (zwork->zw_swork != NULL && zwork->zw_swork->sw_pidok <= 0 && !zwork->zw_swork->run_cmd ) {
 		warnx(
 		    "log %s not compressed because daemon(s) not notified",
 		    zwork->zw_fname);


More information about the freebsd-current mailing list