From 18039a2564037f142f299d73d986942a2cc6b76a Mon Sep 17 00:00:00 2001 From: Tom Goff Date: Tue, 29 Dec 2015 13:50:28 -0500 Subject: [PATCH] daemon: Add a logrotate configuration file. --- daemon/Makefile.am | 14 +++++++++++++- daemon/data/core-daemon.logrotate | 13 +++++++++++++ packaging/deb/core-daemon.install.in | 1 + packaging/rpm/core.spec.in | 1 + 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 daemon/data/core-daemon.logrotate diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 731e3e90..74673b8a 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -75,6 +75,9 @@ EXAMPLE_SERVICES_FILES = \ coreexservicesdir = $(coreexdir)/services dist_coreexservices_DATA= $(EXAMPLE_SERVICES_FILES) +LOGROTATE_DIR = $(sysconfdir)/logrotate.d +LOGROTATE_FILE = data/core-daemon.logrotate + # Python package build noinst_SCRIPTS = build build: @@ -84,6 +87,14 @@ build: install-exec-hook: $(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) install --prefix=${DESTDIR}/${pyprefix} --install-purelib=${DESTDIR}/${pythondir} --install-platlib=${DESTDIR}/${pyexecdir} --no-compile +install-data-local: + $(MKDIR_P) $(DESTDIR)$(LOGROTATE_DIR) + $(INSTALL_DATA) $(LOGROTATE_FILE) \ + $(DESTDIR)$(LOGROTATE_DIR)/`basename $(LOGROTATE_FILE) .logrotate` + +uninstall-local: + rm -f $(DESTDIR)$(LOGROTATE_DIR)/`basename $(LOGROTATE_FILE) .logrotate` + # Python package uninstall uninstall-hook: rm -f ${pythondir}/core_python-${COREDPY_VERSION}-py${PYTHON_VERSION}.egg-info @@ -94,6 +105,7 @@ uninstall-hook: rmdir -p $(coreexmyservicesdir) || true rmdir -p $(coreexdir) || true rmdir -p $(coreconfdir) || true + rmdir -p $(LOGROTATE_DIR) || true # Python package cleanup clean-local: @@ -112,4 +124,4 @@ DISTCLEANFILES = Makefile.in core/*.pyc MANIFEST doc/Makefile.in doc/Makefile \ doc/conf.py core/addons/*.pyc # files to include with distribution tarball -EXTRA_DIST = $(SETUPPY) MANIFEST.in CORE.e4p core doc +EXTRA_DIST = $(SETUPPY) MANIFEST.in CORE.e4p core doc $(LOGROTATE_FILE) diff --git a/daemon/data/core-daemon.logrotate b/daemon/data/core-daemon.logrotate new file mode 100644 index 00000000..e9d96ddc --- /dev/null +++ b/daemon/data/core-daemon.logrotate @@ -0,0 +1,13 @@ +/var/log/core-daemon.log { + rotate 7 + daily + missingok + notifempty + compress + sharedscripts + postrotate + if [ -r /var/run/core-daemon.pid ]; then + kill -USR1 $(cat /var/run/core-daemon.pid) > /dev/null 2>&1 + fi + endscript +} diff --git a/packaging/deb/core-daemon.install.in b/packaging/deb/core-daemon.install.in index 9b0267fa..886be338 100644 --- a/packaging/deb/core-daemon.install.in +++ b/packaging/deb/core-daemon.install.in @@ -20,3 +20,4 @@ # ATpythondirAT is expanding to ${prefix}/lib/python2.7/dist-packages /usr/lib/python2.7/dist-packages /etc/init.d +/etc/logrotate.d diff --git a/packaging/rpm/core.spec.in b/packaging/rpm/core.spec.in index 972a189b..eec0d569 100644 --- a/packaging/rpm/core.spec.in +++ b/packaging/rpm/core.spec.in @@ -302,6 +302,7 @@ sed -i 's/emane_realtime = True/emane_realtime = False/' /etc/core/core.conf %doc %{_mandir}/man1/netns.1.gz %doc %{_mandir}/man1/vcmd.1.gz %doc %{_mandir}/man1/vnoded.1.gz +/etc/logrotate.d/core-daemon /etc/systemd/system/core-daemon.service %{python_sitearch}/core_python_netns-1.0-py%{python_version}.egg-info %{python_sitearch}/netns.so