Summary: Console-based network traffic monitor Name: vnstat Version: 1.4 Release: 9%{?dist} License: GPL Group: System Environment/Daemons URL: http://humdi.net/vnstat/ Source0: http://humdi.net/vnstat/vnstat-%{version}.tar.gz Source1: FAQ.vnstat Requires(pre): /usr/sbin/useradd BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %description vnStat is a console-based network traffic monitor that keeps a log of daily network traffic for the selected interface(s). vnStat isn't a packet sniffer. The traffic information is analyzed from the /proc-filesystem, so vnStat can be used without root permissions. See the webpage for few 'screenshots'. %prep %setup -q %{__cp} %{SOURCE1} FAQ %{__sed} -i 's/ifconfig/ip addr show/' src/vnstat.c %build %{__make} %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" %install %{__rm} -rf $RPM_BUILD_ROOT %{__mkdir_p} $RPM_BUILD_ROOT%{_bindir} %{__mkdir_p} $RPM_BUILD_ROOT%{_sbindir} %{__mkdir_p} $RPM_BUILD_ROOT%{_mandir}/man1 %{__mkdir_p} $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name} %{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/cron.d %{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig %{__install} -m 644 man/vnstat.1 $RPM_BUILD_ROOT%{_mandir}/man1 %{__install} -m 755 src/vnstat $RPM_BUILD_ROOT%{_bindir} %{__cat} >> $RPM_BUILD_ROOT%{_sysconfdir}/cron.d/%{name} << END MAILTO=root # to enable interface monitoring via vnstat remove comment on next line # */5 * * * * vnstat %{_sbindir}/%{name}.cron END %{__cat} >> $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name} << END # see also: vnstat(1) # the following sets vnstat up to monitor eth0 VNSTAT_OPTIONS="-u -i eth0" END %{__cat} >> $RPM_BUILD_ROOT%{_sbindir}/%{name}.cron << END #!/bin/bash # this script (%{_sbindir}/%{name}.cron) reads %{_sysconfdir}/sysconfig/%{name} # to start %{_bindir}/%{name}. # example for %{_sysconfdir}/sysconfig/%{name}: # VNSTAT_OPTIONS="-u -i eth0" # see also: vnstat(1) VNSTAT_CONF=%{_sysconfdir}/sysconfig/%{name} if [ ! -f $VNSTAT_CONF ]; then exit 0 fi . \$VNSTAT_CONF %{_bindir}/%{name} \$VNSTAT_OPTIONS END %clean %{__rm} -rf $RPM_BUILD_ROOT %pre %{_sbindir}/useradd -r -s /sbin/nologin -d %{_localstatedir}/lib/%{name} \ -M -c "vnStat user" %{name} > /dev/null 2>&1 || : %files %defattr(-,root,root,-) %doc CHANGES COPYING FAQ README INSTALL cron pppd %config(noreplace) %{_sysconfdir}/cron.d/%{name} %config(noreplace) %{_sysconfdir}/sysconfig/%{name} %{_mandir}/man1/* %{_bindir}/%{name} %attr(755,root,root)%{_sbindir}/%{name}.cron %attr(-,vnstat,vnstat)%{_localstatedir}/lib/%{name} %changelog * Sun Jun 03 2007 Milan Kerslager 1.4-9.ker.rhel4 - rebuild for RHEL4 (package from F7) * Mon Feb 26 2007 Adrian Reber - 1.4-9 - applied patch for spec file cleanup (#229037) * Fri Sep 15 2006 Adrian Reber - 1.4-8 - rebuilt * Fri Mar 18 2006 Adrian Reber - 1.4-7 - rebuilt; fixed dist tag * Fri Mar 18 2006 Adrian Reber - 1.4-6 - rebuilt * Sun May 22 2005 Jeremy Katz - 1.4-5 - rebuild on all arches * Fri Apr 7 2005 Michael Schwendt - rebuilt * Mon Feb 28 2005 Adrian Reber 1.4-3 - removed occurences of VNSTAT_DISABLED in %{_sysconfdir}/sysconfig/%{name} and %{_sbindir}/%{name}.cron * Thu Feb 24 2005 Adrian Reber 1.4-2 - removed "#--------------" - added %%{version} to Source0 - replaced almost empty FAQ with the one from the web - added INSTALL to %%doc - added %{_sysconfdir}/sysconfig/%{name} and %{_sbindir}/%{name}.cron to allow flexible configuration - cron script and configuration file defaults to vnstat disabled - added example scripts from cron/* and pppd/* to %%doc * Wed Jul 21 2004 Adrian Reber 1.4-1 - initial build