[packages/net-snmp/AC-branch] add logrotate file to rotate log if non-syslog logging is enabled
glen
glen at pld-linux.org
Fri May 15 10:17:27 CEST 2015
commit d3bddfd59eb68a071286c8ae39ff1b7e0e027288
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Thu May 14 17:27:33 2015 +0300
add logrotate file to rotate log if non-syslog logging is enabled
net-snmp.spec | 8 ++++++--
snmpd.logrotate | 10 ++++++++++
2 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/net-snmp.spec b/net-snmp.spec
index 75f17a9..f3f9c66 100644
--- a/net-snmp.spec
+++ b/net-snmp.spec
@@ -32,7 +32,7 @@ Summary(ru.UTF-8): Набор утилит для протокола SNMP от U
Summary(uk.UTF-8): Набір утиліт для протоколу SNMP від UC-Davis
Name: net-snmp
Version: 5.4.4
-Release: 3
+Release: 4
License: BSD-like
Group: Networking/Daemons
Source0: http://downloads.sourceforge.net/net-snmp/%{name}-%{version}.tar.gz
@@ -45,6 +45,7 @@ Source5: %{name}trapd.conf
Source6: %{name}trapd.sysconfig
Source7: ucd-ipchains.tar.gz
# Source7-md5: 29949f1008f1a04d6efefd5b3ea607da
+Source9: snmpd.logrotate
Patch0: %{name}-acfix.patch
Patch2: %{name}-config-noflags.patch
Patch3: %{name}-manpage.patch
@@ -506,7 +507,7 @@ perl -pi -e 's at LD_RUN_PATH="\$\(LD_RUN_PATH\)" @@' */Makefile */*/Makefile
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,sysconfig,snmp},/var/log,/var/lib/net-snmp,%{_libdir}/snmp/dlmod}
+install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,logrotate.d,sysconfig,snmp},/var/log,/var/lib/net-snmp,%{_libdir}/snmp/dlmod}
%{__make} -j1 install \
mibdir=%{_datadir}/mibs \
@@ -525,6 +526,8 @@ install %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/snmptrapd
install %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/snmp/snmptrapd.conf
install %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/snmptrapd
+cp -p %{SOURCE9} $RPM_BUILD_ROOT/etc/logrotate.d/snmpd
+
cd perl
%{__make} -j1 install \
DESTDIR=$RPM_BUILD_ROOT
@@ -606,6 +609,7 @@ fi
%attr(754,root,root) /etc/rc.d/init.d/snmpd
%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/snmpd
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/snmpd
%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/snmp/snmpd.conf
%attr(640,root,root) %config(missingok,noreplace) %verify(not md5 mtime size) %{_sysconfdir}/snmp/snmpd.local.conf
diff --git a/snmpd.logrotate b/snmpd.logrotate
new file mode 100644
index 0000000..baef0eb
--- /dev/null
+++ b/snmpd.logrotate
@@ -0,0 +1,10 @@
+/var/log/snmpd.log
+{
+ create 640 root root
+ postrotate
+ . /etc/sysconfig/snmpd
+ if [ "${LOG_WARNINGS_MESSAGES_TO_SYSLOG:-yes}" = "no" ]; then
+ /sbin/service snmpd reload >/dev/null
+ fi
+ endscript
+}
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/net-snmp.git/commitdiff/d3bddfd59eb68a071286c8ae39ff1b7e0e027288
More information about the pld-cvs-commit
mailing list