From d4767b5f68213545e48428358a2bde2fb94c00dd Mon Sep 17 00:00:00 2001 From: "Chris D. Faulhaber" Date: Thu, 30 Dec 1999 12:35:51 +0000 Subject: Logrotate is a system utility that rotates, compresses, removes and mails system log files PR: 15759 Submitted by: Yuan-Chen Cheng --- sysutils/logrotate/Makefile | 36 +++++++++++++++++ sysutils/logrotate/distinfo | 1 + sysutils/logrotate/files/logrotate.conf.sample | 25 ++++++++++++ sysutils/logrotate/files/patch-aa | 12 ++++++ sysutils/logrotate/files/patch-ab | 29 ++++++++++++++ sysutils/logrotate/files/patch-ac | 22 +++++++++++ sysutils/logrotate/files/patch-ad | 11 ++++++ sysutils/logrotate/files/syslog.sample | 53 ++++++++++++++++++++++++++ sysutils/logrotate/pkg-comment | 1 + sysutils/logrotate/pkg-descr | 5 +++ sysutils/logrotate/pkg-plist | 4 ++ 11 files changed, 199 insertions(+) create mode 100644 sysutils/logrotate/Makefile create mode 100644 sysutils/logrotate/distinfo create mode 100644 sysutils/logrotate/files/logrotate.conf.sample create mode 100644 sysutils/logrotate/files/patch-aa create mode 100644 sysutils/logrotate/files/patch-ab create mode 100644 sysutils/logrotate/files/patch-ac create mode 100644 sysutils/logrotate/files/patch-ad create mode 100644 sysutils/logrotate/files/syslog.sample create mode 100644 sysutils/logrotate/pkg-comment create mode 100644 sysutils/logrotate/pkg-descr create mode 100644 sysutils/logrotate/pkg-plist (limited to 'sysutils/logrotate') diff --git a/sysutils/logrotate/Makefile b/sysutils/logrotate/Makefile new file mode 100644 index 000000000000..a1a0c9722a00 --- /dev/null +++ b/sysutils/logrotate/Makefile @@ -0,0 +1,36 @@ +# New ports collection makefile for: logrotate +# Version required: 3.3 +# Date Created: 29 Dec 1999 +# Whom: Yuan-Chen Cheng +# +# $FreeBSD$ +# + +DISTNAME= logrotate-3.3 +CATEGORIES= sysutils +MASTER_SITES= ftp://ftp.redhat.com/pub/redhat/current/SRPMS/SRPMS/ \ + ftp://ftp.cdrom.com/pub/linux/redhat/current/SRPMS/SRPMS/ +EXTRACT_SUFX= -1.src.rpm + +MAINTAINER= ycheng@sinica.edu.tw + +BUILD_DEPENDS= ${LOCALBASE}/bin/rpm2cpio:${PORTSDIR}/misc/rpm \ + ${LOCALBASE}/lib/libpopt.a:${PORTSDIR}/devel/popt + +USE_GMAKE= yes +MAN8= logrotate.8 +MANCOMPRESSED= no + +do-extract: + @${RM} -rf ${WRKDIR} + @${MKDIR} ${WRKDIR} + @rpm2cpio ${_DISTDIR}${DISTFILES} | (cd ${WRKDIR}; cpio -i) + @tar -xzf ${WRKDIR}/${DISTNAME}.tar.gz -C ${WRKDIR} + +post-install: + @${MKDIR} ${PREFIX}/etc/logrotate.d + @${SED} -e 's|__PREFIX__|${PREFIX}|' \ + < ${FILESDIR}/logrotate.conf.sample > ${PREFIX}/etc/logrotate.conf.sample + @${INSTALL_DATA} ${FILESDIR}/syslog.sample ${PREFIX}/etc/logrotate.d/ + +.include diff --git a/sysutils/logrotate/distinfo b/sysutils/logrotate/distinfo new file mode 100644 index 000000000000..f05d5e80ea4b --- /dev/null +++ b/sysutils/logrotate/distinfo @@ -0,0 +1 @@ +MD5 (logrotate-3.3-1.src.rpm) = 3a399653214c9dd6b23363d4ff68b633 diff --git a/sysutils/logrotate/files/logrotate.conf.sample b/sysutils/logrotate/files/logrotate.conf.sample new file mode 100644 index 000000000000..70a0c3e66e8d --- /dev/null +++ b/sysutils/logrotate/files/logrotate.conf.sample @@ -0,0 +1,25 @@ +# see "man logrotate" for details +# rotate log files weekly +weekly + +# keep 4 weeks worth of backlogs +rotate 4 + +# send errors to root +errors root + +# create new (empty) log files after rotating old ones +create + +# uncomment this if you want your log files compressed +compress + +# RPM packages drop log rotation information into this directory +include __PREFIX__/etc/logrotate.d + +/var/log/lastlog { + monthly + rotate 1 +} + +# system-specific logs may be configured here diff --git a/sysutils/logrotate/files/patch-aa b/sysutils/logrotate/files/patch-aa new file mode 100644 index 000000000000..8c309e4706d7 --- /dev/null +++ b/sysutils/logrotate/files/patch-aa @@ -0,0 +1,12 @@ +--- config.c.orig Tue Dec 28 15:24:25 1999 ++++ config.c Tue Dec 28 15:26:54 1999 +@@ -1,9 +1,7 @@ +-#include + #include + #include + #include + #include +-#include + #include + #include + #include diff --git a/sysutils/logrotate/files/patch-ab b/sysutils/logrotate/files/patch-ab new file mode 100644 index 000000000000..ce6b777e5dde --- /dev/null +++ b/sysutils/logrotate/files/patch-ab @@ -0,0 +1,29 @@ +--- Makefile.orig Wed Dec 30 03:29:13 1998 ++++ Makefile Tue Dec 28 15:35:52 1999 +@@ -2,11 +2,13 @@ + CVSTAG = r$(subst .,-,$(VERSION)) + CFLAGS = -Wall -D_GNU_SOURCE -DVERSION=\"$(VERSION)\" $(RPM_OPT_FLAGS) + PROG = logrotate +-BINDIR = /usr/sbin +-MANDIR = /usr/man ++BINDIR = sbin ++MANDIR = man + MAN = logrotate.8 + LOADLIBES = -lpopt + ++LOADLIBES += -L/usr/local/lib ++CFLAGS += -I/usr/local/include + #-------------------------------------------------------------------------- + + OBJS = logrotate.o log.o config.o basenames.o +@@ -40,8 +42,8 @@ + [ -d $(PREFIX)/$(MANDIR) ] || mkdir -p $(PREFIX)/$(MANDIR) + [ -d $(PREFIX)/$(MANDIR)/man8 ] || mkdir -p $(PREFIX)/$(MANDIR)/man8 + +- install -s -m 755 $(PROG) $(PREFIX)/$(BINDIR) +- install -m 644 $(MAN) $(PREFIX)/$(MANDIR)/man`echo $(MAN) | sed "s/.*\.//"`/$(MAN) ++ install -c -s -m 755 $(PROG) $(PREFIX)/$(BINDIR) ++ install -c -m 644 $(MAN) $(PREFIX)/$(MANDIR)/man`echo $(MAN) | sed "s/.*\.//"`/$(MAN) + + co: + co RCS/*,v diff --git a/sysutils/logrotate/files/patch-ac b/sysutils/logrotate/files/patch-ac new file mode 100644 index 000000000000..1c3ca0adb866 --- /dev/null +++ b/sysutils/logrotate/files/patch-ac @@ -0,0 +1,22 @@ +--- logrotate.c.orig Thu Jun 17 04:37:19 1999 ++++ logrotate.c Wed Dec 29 11:31:57 1999 +@@ -1,9 +1,7 @@ +-#include + #include + #include + #include + #include +-#include + #include + #include + #include +@@ -457,6 +455,9 @@ + hasErrors = 1; + } + } ++ ++ message(MESS_DEBUG, "sleep 10 to wait daemon close log\n"); ++ sleep(10); + + if (!hasErrors && !log->rotateCount) { + message(MESS_DEBUG, "removing rotated log (rotateCount == 0)"); diff --git a/sysutils/logrotate/files/patch-ad b/sysutils/logrotate/files/patch-ad new file mode 100644 index 000000000000..169bced9d1c3 --- /dev/null +++ b/sysutils/logrotate/files/patch-ad @@ -0,0 +1,11 @@ +--- logrotate.h.orig Tue Dec 28 15:55:44 1999 ++++ logrotate.h Tue Dec 28 15:55:56 1999 +@@ -12,7 +12,7 @@ + #define LOG_FLAG_MISSINGOK (1 << 5) + #define LOG_FLAG_MAILFIRST (1 << 6) + +-#define DEFAULT_MAIL_COMMAND "/bin/mail -s" ++#define DEFAULT_MAIL_COMMAND "/usr/bin/mail -s" + #define COMPRESS_COMMAND "gzip -9" + #define COMPRESS_EXT ".gz" + #define UNCOMPRESS_PIPE "gunzip" diff --git a/sysutils/logrotate/files/syslog.sample b/sysutils/logrotate/files/syslog.sample new file mode 100644 index 000000000000..cb2268ab59cb --- /dev/null +++ b/sysutils/logrotate/files/syslog.sample @@ -0,0 +1,53 @@ +/var/cron/log { + postrotate + /usr/bin/killall -HUP syslogd + endscript +} + +/var/log/amd.log { + postrotate + /usr/bin/killall -HUP syslogd + endscript +} + +/var/log/kerberos.log { + postrotate + /usr/bin/killall -HUP syslogd + endscript +} + +/var/log/lpd-errs { + postrotate + /usr/bin/killall -HUP syslogd + endscript +} + +/var/log/maillog { + postrotate + /usr/bin/killall -HUP syslogd + endscript +} + +/var/log/sendmail.st { + postrotate + /usr/bin/killall -HUP syslogd + endscript +} + +/var/log/messages { + postrotate + /usr/bin/killall -HUP syslogd + endscript +} + +/var/log/slip.log { + postrotate + /usr/bin/killall -HUP syslogd + endscript +} + +/var/log/ppp.log { + postrotate + /usr/bin/killall -HUP syslogd + endscript +} diff --git a/sysutils/logrotate/pkg-comment b/sysutils/logrotate/pkg-comment new file mode 100644 index 000000000000..8b7ec34534db --- /dev/null +++ b/sysutils/logrotate/pkg-comment @@ -0,0 +1 @@ +Daemon to rotate, compress, remove and mail system log files diff --git a/sysutils/logrotate/pkg-descr b/sysutils/logrotate/pkg-descr new file mode 100644 index 000000000000..a6025679c87b --- /dev/null +++ b/sysutils/logrotate/pkg-descr @@ -0,0 +1,5 @@ +Daemon to rotate, compress, remove and mail system log files. + +I try to make it work just like /usr/sbin/newsyslog. +With logrotate, you can mail syslog and execute command +before or after logrotate. diff --git a/sysutils/logrotate/pkg-plist b/sysutils/logrotate/pkg-plist new file mode 100644 index 000000000000..823d5907347b --- /dev/null +++ b/sysutils/logrotate/pkg-plist @@ -0,0 +1,4 @@ +sbin/logrotate +etc/logrotate.conf.sample +etc/logrotate.d/syslog.sample +@dirrm etc/logrotate.d -- cgit v1.2.3