Accepting request 346126 from home:mnhauke:security
- update to version 1.5.2 - add patch: pmacct-fix-implicit-pointer-decl.diff - do not build with ULOG on newer versions > 13.2 since it got removed from mainstream linux kernel >= 3.17 http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=7200135bc1e61f1437dc326ae2ef2f310c50b4eb - update to version 1.5.1 + BMP daemon: BMP, BGP Monitoring Protocol, can be used to monitor BGP sessions. The current implementation is base on the draft-ietf-grow-bmp-07 IETF draft. The daemon currently supports BMP events and stats only, ie. initiation, termination, peer up, peer down and stats reports messages. Route Monitoring is future (upcoming) work but routes can be currently sourced via the BGP daemon thread (best path only or ADD-PATH), making the two daemons complementary. The daemon enables to write BMP messages to files or AMQP queues, real-time (msglog) or at regular time intervals (dump) and is a separate thread in the NetFlow (nfacctd) or sFlow (sfacctd) collectors. + tmp_net_own_field directive is introduced to record both individual source and destination IP addresses and their IP prefix (nets) as part of the same aggregation method. While this should become default behaviour, a knob for backward-compatibility is made available for all 1.5 until the next major release. + Introduced nfacctd_stitching and equivalents (ie. sfacctd_stitching): when set to true, given an aggregation method, two new non-key fields are added to the aggregate upon purging data to the backend: timestamp_min is the timestamp of the first element contributing to a certain aggregate and timestamp_max is the timestamp of the last element. In case the export protocol provides time references, ie. NetFlow/IPFIX, these are used; if not the current time (hence time of arrival to the collector) is used instead. OBS-URL: https://build.opensuse.org/request/show/346126 OBS-URL: https://build.opensuse.org/package/show/server:monitoring/pmacct?expand=0&rev=79
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d9f9a454a1f8a5aeeb381610f7d6cbff1eeaae95092903f2f823e47bacc5c49e
|
||||
size 428124
|
3
pmacct-1.5.2.tar.gz
Normal file
3
pmacct-1.5.2.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c12e3897e2f9aa89333968da46eb46855f357750ac1e06e36e72f374e2b54df9
|
||||
size 897530
|
12
pmacct-fix-implicit-pointer-decl.diff
Normal file
12
pmacct-fix-implicit-pointer-decl.diff
Normal file
@@ -0,0 +1,12 @@
|
||||
diff --git a/src/util.c b/src/util.c
|
||||
index 5e17bcd..b3d5222 100644
|
||||
--- a/src/util.c
|
||||
+++ b/src/util.c
|
||||
@@ -22,6 +22,7 @@
|
||||
#define __UTIL_C
|
||||
|
||||
/* includes */
|
||||
+#include <sys/file.h>
|
||||
#include "pmacct.h"
|
||||
#include "pmacct-data.h"
|
||||
#include "ip_flow.h"
|
@@ -1,11 +0,0 @@
|
||||
--- src/bgp/bgp.c.orig 2010-02-17 20:29:36.000000000 +0100
|
||||
+++ src/bgp/bgp.c 2010-02-17 20:30:54.000000000 +0100
|
||||
@@ -283,7 +283,7 @@
|
||||
}
|
||||
else {
|
||||
if (peer->buf.len > BGP_MAX_PACKET_SIZE) {
|
||||
- realloc(peer->buf.base, BGP_MAX_PACKET_SIZE);
|
||||
+ peer->buf.base = realloc(peer->buf.base, BGP_MAX_PACKET_SIZE);
|
||||
memset(peer->buf.base, 0, BGP_MAX_PACKET_SIZE);
|
||||
peer->buf.len = BGP_MAX_PACKET_SIZE;
|
||||
}
|
106
pmacct.changes
106
pmacct.changes
@@ -1,3 +1,109 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Sep 8 15:11:04 UTC 2015 - mardnh@gmx.de
|
||||
|
||||
- update to version 1.5.2
|
||||
- add patch: pmacct-fix-implicit-pointer-decl.diff
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Jul 26 07:57:48 UTC 2015 - mardnh@gmx.de
|
||||
|
||||
- do not build with ULOG on newer versions > 13.2 since it got removed
|
||||
from mainstream linux kernel >= 3.17
|
||||
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=7200135bc1e61f1437dc326ae2ef2f310c50b4eb
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Feb 21 20:28:55 UTC 2015 - mardnh@gmx.de
|
||||
|
||||
- update to version 1.5.1
|
||||
+ BMP daemon: BMP, BGP Monitoring Protocol, can be used to monitor BGP
|
||||
sessions. The current implementation is base on the draft-ietf-grow-bmp-07
|
||||
IETF draft. The daemon currently supports BMP events and stats only, ie.
|
||||
initiation, termination, peer up, peer down and stats reports messages.
|
||||
Route Monitoring is future (upcoming) work but routes can be currently
|
||||
sourced via the BGP daemon thread (best path only or ADD-PATH), making
|
||||
the two daemons complementary. The daemon enables to write BMP messages
|
||||
to files or AMQP queues, real-time (msglog) or at regular time intervals
|
||||
(dump) and is a separate thread in the NetFlow (nfacctd) or sFlow (sfacctd)
|
||||
collectors.
|
||||
+ tmp_net_own_field directive is introduced to record both individual source
|
||||
and destination IP addresses and their IP prefix (nets) as part of the same
|
||||
aggregation method. While this should become default behaviour, a knob for
|
||||
backward-compatibility is made available for all 1.5 until the next major
|
||||
release.
|
||||
+ Introduced nfacctd_stitching and equivalents (ie. sfacctd_stitching):
|
||||
when set to true, given an aggregation method, two new non-key fields are
|
||||
added to the aggregate upon purging data to the backend: timestamp_min is
|
||||
the timestamp of the first element contributing to a certain aggregate
|
||||
and timestamp_max is the timestamp of the last element. In case the export
|
||||
protocol provides time references, ie. NetFlow/IPFIX, these are used; if not
|
||||
the current time (hence time of arrival to the collector) is used instead.
|
||||
+ Introduced amqp_routing_key_rr feature to perform round-robin load-
|
||||
balancing over a set of routing keys. This is in addition to existing,
|
||||
and more involved, functionality of tag-based load-balancing.
|
||||
+ Introduced amqp_multi_values feature: this is same feature in concept as
|
||||
sql_multi_values (see docs). The value is the amount of elements to pack
|
||||
in each JSON array.
|
||||
+ Introduced amqp_vhost and companion (ie. bgp_daemon_msglog_amqp_vhost)
|
||||
configuration directives to define the AMQP/RabbitMQ server virtual host.
|
||||
+ BGP daemon: bgp_daemon_id now allows to define the BGP Router-ID disjoint
|
||||
from the bgp_daemon_ip definition. Thanks to Bela Toros for his patch.
|
||||
+ tee plugin: introduced tee_ipprec feature to color replicated packets,
|
||||
both in transparent and non-transparent modes. Useful, especially when
|
||||
in transparent mode and replicating to hosts in different subnets, to
|
||||
verify which packets are coming from the replicator.
|
||||
+ tee plugin: plugin-kernel send buffer size is now configurable via a new
|
||||
config directive tee_pipe_size. Improved logging of send() failures.
|
||||
+ nfacctd: introduced support for IPFIX sampling/renormalization using
|
||||
element IDs: #302 (selectorId), #305 (samplingPacketInterval) and #306
|
||||
(samplingPacketSpace). Many thanks to Rene Stoutjesdijk for his support.
|
||||
+ nfacctd: added also support for VLAN ID for NetFlow v9/IPFIX via element
|
||||
type #243 (it was already supported via elements #58 and #59). Support was
|
||||
also added for 802.1p/CoS via element #244.
|
||||
+ nfacctd: added native support for NetFlow v9/IPFIX IE #252 and #253 as
|
||||
part of existing primitives in_iface and out_iface (additional check).
|
||||
+ pre_tag_map: introduced 'cvlan primitive. In NetFlow v9 and IPFIX this is
|
||||
compared against IE #245. The primitive also supports map indexing.
|
||||
+ Introduced pre_tag_label_filter to filter on the 'label' primitive in a
|
||||
similar way how the existing pre_tag_filter feature works against the
|
||||
'tag' primitive. Null label values (ie. unlabelled data) can be matched
|
||||
using the 'null' keyword. Negations are allowed by pre-pending a minus
|
||||
sign to the label value.
|
||||
+ IMT plugin: introduced '-i' command-line option to pmacct client tool: it
|
||||
shows last time (in seconds) statistis were cleared via 'pmacct -e'.
|
||||
+ print, MongoDB & AMQP plugins: sql_startup_delay feature ported to these
|
||||
plugins.
|
||||
! sql_num_hosts: the feature has been improved to support IPv6 addresses.
|
||||
Pre-requisite is definition of INET6_ATON() function in the RDBMS, which
|
||||
is the case for MySQL >= 5.6.3. In SQLite such function has to be defined
|
||||
manually.
|
||||
! nfacctd: improved NF_evaluate_flow_type() euristics to reckon NetFlow/
|
||||
IPFIX event (NAT, Firewall, etc.) vs traffic (flows) records.
|
||||
! fix, GeoIP: spit log notification (warning) in case GeoIP_open() returns
|
||||
null pointer.
|
||||
! fix, IMT plugin: pmacct client -M and -N queries were failing to report
|
||||
results on exact matches. Affected: 1.5.0. Thanks to Xavier Vitard for
|
||||
reporting the issue.
|
||||
! fix, pkt_handlers.c: missing else in NF_src_host_handler() was causing
|
||||
IPv6 prefix being copied instead of IPv6 address against NetFlow v9 recs
|
||||
containing both info.
|
||||
! fix, uacctd: informational log message now shows the correct group the
|
||||
daemon is bound to. Thanks to Marco Marzetti for reporting the issue.
|
||||
! fix, nfv9_template.c: missing byte conversion while decoding templates
|
||||
was causing SEGV under certain conditions. Thanks to Sergio Bellini for
|
||||
reporting the issue.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Nov 6 21:50:04 UTC 2014 - mardnh@gmx.de
|
||||
|
||||
- temporary workaround for misc compile issues
|
||||
* removed post-build-checks
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Sep 17 13:50:20 UTC 2014 - mardnh@gmx.de
|
||||
|
||||
- update to version 1.5.0
|
||||
- specfile cleanup
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jul 30 06:09:43 UTC 2010 - pascal.bleser@opensuse.org
|
||||
|
||||
|
143
pmacct.spec
143
pmacct.spec
@@ -1,20 +1,44 @@
|
||||
Summary: Promiscuous mode IP Accounting package
|
||||
Name: pmacct
|
||||
Version: 0.12.3
|
||||
Release: 0
|
||||
License: GPL
|
||||
Group: Productivity/Networking/Diagnostic
|
||||
# http://www.pmacct.net/pmacct-%{version}.tar.gz
|
||||
Source: %{name}-%{version}.tar.bz2
|
||||
Source1: nfacctd.init
|
||||
Source2: pmacctd.init
|
||||
Source3: sfacctd.init
|
||||
Patch1: pmacct-fix_realloc.patch
|
||||
URL: http://www.pmacct.net/
|
||||
BuildRoot: %{_tmppath}/%{name}-root
|
||||
BuildRequires: mysql-devel postgresql-devel
|
||||
BuildRequires: sqlite-devel >= 3.0.0
|
||||
BuildRequires: libpcap-devel
|
||||
#
|
||||
# spec file for package pmacct
|
||||
#
|
||||
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
Name: pmacct
|
||||
Version: 1.5.2
|
||||
Release: 0
|
||||
Summary: Accounting and aggregation toolsuite for IPv4 and IPv6
|
||||
License: GPL-2.0
|
||||
Group: Productivity/Networking/Diagnostic
|
||||
Url: http://www.pmacct.net/
|
||||
Source: http://www.pmacct.net/pmacct-%{version}.tar.gz
|
||||
Source1: nfacctd.init
|
||||
Source2: pmacctd.init
|
||||
Source3: sfacctd.init
|
||||
Source4: uacctd.init
|
||||
# PATCH-FIX-UPSTREAM pmacct-fix-implicit-pointer-decl.diff
|
||||
Patch1: pmacct-fix-implicit-pointer-decl.diff
|
||||
BuildRequires: libmysqlclient-devel
|
||||
BuildRequires: libpcap-devel
|
||||
BuildRequires: libstdc++-devel
|
||||
BuildRequires: pkg-config
|
||||
BuildRequires: postgresql-devel
|
||||
BuildRequires: sqlite-devel >= 3.0.0
|
||||
BuildRequires: pkgconfig(geoip)
|
||||
BuildRequires: pkgconfig(jansson)
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
%description
|
||||
pmacct is a small set of passive network monitoring tools to measure, account,
|
||||
@@ -28,52 +52,75 @@ export data to tools like RRDtool, GNUPlot, Net-SNMP, MRTG, and Cacti.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch1
|
||||
chmod a+rx docs examples sql
|
||||
find docs examples sql -type f -print0 | xargs -r0 chmod -x
|
||||
%patch1 -p1
|
||||
|
||||
# fix permissions
|
||||
chmod -x sql/pmacct-*
|
||||
|
||||
%build
|
||||
export CFLAGS="%{optflags} -Wno-return-type"
|
||||
%configure \
|
||||
--sysconfdir=%{_sysconfdir}/%{name} \
|
||||
--enable-threads \
|
||||
--enable-64bit \
|
||||
--enable-mysql \
|
||||
--enable-pgsql \
|
||||
--enable-sqlite3 \
|
||||
--enable-ulog \
|
||||
--enable-l2 \
|
||||
--enable-ipv6 \
|
||||
--enable-v4-mapped \
|
||||
--with-pgsql-includes=/usr/include/pgsql/
|
||||
--enable-mysql \
|
||||
--enable-pgsql \
|
||||
--with-pgsql-includes=%{_includedir}/pgsql/ \
|
||||
--enable-sqlite3 \
|
||||
--enable-geoip \
|
||||
--enable-jansson \
|
||||
--enable-64bit \
|
||||
%if 0%{?suse_version} <= 1320 != (0%{?suse_version} == 1315 && 0%{?is_opensuse})
|
||||
--enable-ulog \
|
||||
%endif
|
||||
--enable-threads
|
||||
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%__make %{?jobs:-j%{jobs}}
|
||||
|
||||
%install
|
||||
%makeinstall
|
||||
make DESTDIR=%{buildroot} install %{?_smp_mflags}
|
||||
|
||||
%{__install} -Dp %{SOURCE1} %{buildroot}/%{_sysconfdir}/init.d/nfacctd
|
||||
%{__install} -Dp %{SOURCE2} %{buildroot}/%{_sysconfdir}/init.d/pmacctd
|
||||
%{__install} -Dp %{SOURCE3} %{buildroot}/%{_sysconfdir}/init.d/sfacctd
|
||||
ln -sf ../../etc/init.d/nfacctd $RPM_BUILD_ROOT/usr/sbin/rcnfacctd
|
||||
ln -sf ../../etc/init.d/pmacctd $RPM_BUILD_ROOT/usr/sbin/rcpmacctd
|
||||
ln -sf ../../etc/init.d/sfacctd $RPM_BUILD_ROOT/usr/sbin/rcsfacctd
|
||||
install -Dp %{SOURCE1} %{buildroot}/%{_sysconfdir}/init.d/nfacctd
|
||||
install -Dp %{SOURCE2} %{buildroot}/%{_sysconfdir}/init.d/pmacctd
|
||||
install -Dp %{SOURCE3} %{buildroot}/%{_sysconfdir}/init.d/sfacctd
|
||||
install -Dp %{SOURCE4} %{buildroot}/%{_sysconfdir}/init.d/uacctd
|
||||
ln -sf ../..%{_initddir}/nfacctd %{buildroot}%{_sbindir}/rcnfacctd
|
||||
ln -sf ../..%{_initddir}/pmacctd %{buildroot}%{_sbindir}/rcpmacctd
|
||||
ln -sf ../..%{_initddir}/sfacctd %{buildroot}%{_sbindir}/rcsfacctd
|
||||
ln -sf ../..%{_initddir}/sfacctd %{buildroot}%{_sbindir}/rcuacctd
|
||||
|
||||
%{__install} -Dp examples/nfacctd-sql_v2.conf.example %{buildroot}/%{_sysconfdir}/pmacct/nfacctd.conf
|
||||
%{__install} -Dp examples/pmacctd-sql_v2.conf.example %{buildroot}/%{_sysconfdir}/pmacct/pmacctd.conf
|
||||
touch %{buildroot}/%{_sysconfdir}/pmacct/sfacctd.conf
|
||||
|
||||
%clean
|
||||
%{__rm} -rf %{buildroot}
|
||||
install -Dp examples/nfacctd-sql_v2.conf.example %{buildroot}/%{_sysconfdir}/pmacct/nfacctd.conf
|
||||
install -Dp examples/pmacctd-sql_v2.conf.example %{buildroot}/%{_sysconfdir}/pmacct/pmacctd.conf
|
||||
#touch %{buildroot}/%{_sysconfdir}/pmacct/sfacctd.conf
|
||||
|
||||
%files
|
||||
%defattr(-, root, root)
|
||||
%doc AUTHORS ChangeLog CONFIG-KEYS COPYING EXAMPLES FAQS INSTALL KNOWN-BUGS NEWS README TODO TOOLS UPGRADE
|
||||
%defattr(-,root,root)
|
||||
%doc AUTHORS ChangeLog CONFIG-KEYS COPYING FAQS KNOWN-BUGS NEWS README TODO TOOLS UPGRADE
|
||||
%doc docs examples sql
|
||||
%attr(755,root,root) %{_bindir}/*
|
||||
%attr(755,root,root) %{_sbindir}/*
|
||||
%{_sysconfdir}/init.d/*
|
||||
%dir /etc/pmacct
|
||||
%{_bindir}/pmacct
|
||||
%{_bindir}/pmmyplay
|
||||
%{_bindir}/pmpgplay
|
||||
#
|
||||
%{_sbindir}/nfacctd
|
||||
%{_sbindir}/pmacctd
|
||||
%{_sbindir}/sfacctd
|
||||
%{_sbindir}/uacctd
|
||||
#
|
||||
%{_sysconfdir}/init.d/nfacctd
|
||||
%{_sysconfdir}/init.d/pmacctd
|
||||
%{_sysconfdir}/init.d/sfacctd
|
||||
%{_sysconfdir}/init.d/uacctd
|
||||
#
|
||||
%{_sbindir}/rcnfacctd
|
||||
%{_sbindir}/rcpmacctd
|
||||
%{_sbindir}/rcsfacctd
|
||||
%{_sbindir}/rcuacctd
|
||||
#
|
||||
%dir %{_sysconfdir}/pmacct
|
||||
%attr(600,root,root) %config(noreplace) %{_sysconfdir}/pmacct/nfacctd.conf
|
||||
%attr(600,root,root) %config(noreplace) %{_sysconfdir}/pmacct/pmacctd.conf
|
||||
%attr(600,root,root) %config(noreplace) %{_sysconfdir}/pmacct/sfacctd.conf
|
||||
#%attr(600,root,root) %config(noreplace) %{_sysconfdir}/pmacct/sfacctd.conf
|
||||
|
||||
%changelog
|
||||
|
262
uacctd.init
Normal file
262
uacctd.init
Normal file
@@ -0,0 +1,262 @@
|
||||
#! /bin/sh
|
||||
# Copyright (c) 1995-2004 SUSE Linux AG, Nuernberg, Germany.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Author: Peter Nixon http://peternixon.net
|
||||
#
|
||||
# /etc/init.d/uacctd
|
||||
# and its symbolic link
|
||||
# /(usr/)sbin/rcuacctd
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# LSB compatible service control script; see http://www.linuxbase.org/spec/
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: uacctd
|
||||
# Required-Start: $syslog $network $remote_fs
|
||||
# Should-Start: $time postgresql mysql
|
||||
# Required-Stop: $syslog $remote_fs
|
||||
# Should-Stop: $time
|
||||
# Default-Start: 3 5
|
||||
# Default-Stop: 0 1 2 6
|
||||
# Short-Description: uacctd daemon providing Netflow collection service
|
||||
# Description: Start uacctd to allow collection of Netflow data from network equipment
|
||||
### END INIT INFO
|
||||
#
|
||||
# Any extensions to the keywords given above should be preceeded by
|
||||
# X-VendorTag- (X-UnitedLinux- X-SuSE- for us) according to LSB.
|
||||
#
|
||||
# Notes on Required-Start/Should-Start:
|
||||
# * There are two different issues that are solved by Required-Start
|
||||
# and Should-Start
|
||||
# (a) Hard dependencies: This is used by the runlevel editor to determine
|
||||
# which services absolutely need to be started to make the start of
|
||||
# this service make sense. Example: nfsserver should have
|
||||
# Required-Start: $portmap
|
||||
# Also, required services are started before the dependent ones.
|
||||
# The runlevel editor will warn about such missing hard dependencies
|
||||
# and suggest enabling. During system startup, you may expect an error,
|
||||
# if the dependency is not fulfilled.
|
||||
# (b) Specifying the init script ordering, not real (hard) dependencies.
|
||||
# This is needed by insserv to determine which service should be
|
||||
# started first (and at a later stage what services can be started
|
||||
# in parallel). The tag Should-Start: is used for this.
|
||||
# It tells, that if a service is available, it should be started
|
||||
# before. If not, never mind.
|
||||
# * When specifying hard dependencies or ordering requirements, you can
|
||||
# use names of services (contents of their Provides: section)
|
||||
# or pseudo names starting with a $. The following ones are available
|
||||
# according to LSB (1.1):
|
||||
# $local_fs all local file systems are mounted
|
||||
# (most services should need this!)
|
||||
# $remote_fs all remote file systems are mounted
|
||||
# (note that /usr may be remote, so
|
||||
# many services should Require this!)
|
||||
# $syslog system logging facility up
|
||||
# $network low level networking (eth card, ...)
|
||||
# $named hostname resolution available
|
||||
# $netdaemons all network daemons are running
|
||||
# The $netdaemons pseudo service has been removed in LSB 1.2.
|
||||
# For now, we still offer it for backward compatibility.
|
||||
# These are new (LSB 1.2):
|
||||
# $time the system time has been set correctly
|
||||
# $portmap SunRPC portmapping service available
|
||||
# UnitedLinux extensions:
|
||||
# $ALL indicates that a script should be inserted
|
||||
# at the end
|
||||
# * The services specified in the stop tags
|
||||
# (Required-Stop/Should-Stop)
|
||||
# specify which services need to be still running when this service
|
||||
# is shut down. Often the entries there are just copies or a subset
|
||||
# from the respective start tag.
|
||||
# * Should-Start/Stop are now part of LSB as of 2.0,
|
||||
# formerly SUSE/Unitedlinux used X-UnitedLinux-Should-Start/-Stop.
|
||||
# insserv does support both variants.
|
||||
# * X-UnitedLinux-Default-Enabled: yes/no is used at installation time
|
||||
# (%fillup_and_insserv macro in %post of many RPMs) to specify whether
|
||||
# a startup script should default to be enabled after installation.
|
||||
# It's not used by insserv.
|
||||
#
|
||||
# Note on runlevels:
|
||||
# 0 - halt/poweroff 6 - reboot
|
||||
# 1 - single user 2 - multiuser without network exported
|
||||
# 3 - multiuser w/ network (text mode) 5 - multiuser w/ network and X11 (xdm)
|
||||
#
|
||||
# Note on script names:
|
||||
# http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/scrptnames.html
|
||||
# A registry has been set up to manage the init script namespace.
|
||||
# http://www.lanana.org/
|
||||
# Please use the names already registered or register one or use a
|
||||
# vendor prefix.
|
||||
|
||||
|
||||
# Check for missing binaries (stale symlinks should not happen)
|
||||
# Note: Special treatment of stop for LSB conformance
|
||||
NFACCTD_BIN=/usr/sbin/uacctd
|
||||
test -x $NFACCTD_BIN || { echo "$NFACCTD_BIN not installed";
|
||||
if [ "$1" = "stop" ]; then exit 0;
|
||||
else exit 5; fi; }
|
||||
|
||||
# Check for existence of needed config file and read it
|
||||
NFACCTD_CONFIG=/etc/pmacct/uacctd.conf
|
||||
test -r $NFACCTD_CONFIG || { echo "$NFACCTD_CONFIG not existing";
|
||||
if [ "$1" = "stop" ]; then exit 0;
|
||||
else exit 6; fi; }
|
||||
|
||||
# Read config
|
||||
#. $NFACCTD_CONFIG
|
||||
|
||||
# Source LSB init functions
|
||||
# providing start_daemon, killproc, pidofproc,
|
||||
# log_success_msg, log_failure_msg and log_warning_msg.
|
||||
# This is currently not used by UnitedLinux based distributions and
|
||||
# not needed for init scripts for UnitedLinux only. If it is used,
|
||||
# the functions from rc.status should not be sourced or used.
|
||||
#. /lib/lsb/init-functions
|
||||
|
||||
# Shell functions sourced from /etc/rc.status:
|
||||
# rc_check check and set local and overall rc status
|
||||
# rc_status check and set local and overall rc status
|
||||
# rc_status -v be verbose in local rc status and clear it afterwards
|
||||
# rc_status -v -r ditto and clear both the local and overall rc status
|
||||
# rc_status -s display "skipped" and exit with status 3
|
||||
# rc_status -u display "unused" and exit with status 3
|
||||
# rc_failed set local and overall rc status to failed
|
||||
# rc_failed <num> set local and overall rc status to <num>
|
||||
# rc_reset clear both the local and overall rc status
|
||||
# rc_exit exit appropriate to overall rc status
|
||||
# rc_active checks whether a service is activated by symlinks
|
||||
. /etc/rc.status
|
||||
|
||||
# Reset status of this service
|
||||
rc_reset
|
||||
|
||||
# Return values acc. to LSB for all commands but status:
|
||||
# 0 - success
|
||||
# 1 - generic or unspecified error
|
||||
# 2 - invalid or excess argument(s)
|
||||
# 3 - unimplemented feature (e.g. "reload")
|
||||
# 4 - user had insufficient privileges
|
||||
# 5 - program is not installed
|
||||
# 6 - program is not configured
|
||||
# 7 - program is not running
|
||||
# 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl)
|
||||
#
|
||||
# Note that starting an already running service, stopping
|
||||
# or restarting a not-running service as well as the restart
|
||||
# with force-reload (in case signaling is not supported) are
|
||||
# considered a success.
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting uacctd "
|
||||
## Start daemon with startproc(8). If this fails
|
||||
## the return value is set appropriately by startproc.
|
||||
/sbin/startproc $NFACCTD_BIN -f $NFACCTD_CONFIG
|
||||
|
||||
# Remember status and be verbose
|
||||
rc_status -v
|
||||
;;
|
||||
stop)
|
||||
echo -n "Shutting down uacctd "
|
||||
## Stop daemon with killproc(8) and if this fails
|
||||
## killproc sets the return value according to LSB.
|
||||
|
||||
/sbin/killproc -TERM $NFACCTD_BIN
|
||||
|
||||
# Remember status and be verbose
|
||||
rc_status -v
|
||||
;;
|
||||
try-restart|condrestart)
|
||||
## Do a restart only if the service was active before.
|
||||
## Note: try-restart is now part of LSB (as of 1.9).
|
||||
## RH has a similar command named condrestart.
|
||||
if test "$1" = "condrestart"; then
|
||||
echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
|
||||
fi
|
||||
$0 status
|
||||
if test $? = 0; then
|
||||
$0 restart
|
||||
else
|
||||
rc_reset # Not running is not a failure.
|
||||
fi
|
||||
# Remember status and be quiet
|
||||
rc_status
|
||||
;;
|
||||
restart)
|
||||
## Stop the service and regardless of whether it was
|
||||
## running or not, start it again.
|
||||
$0 stop
|
||||
$0 start
|
||||
|
||||
# Remember status and be quiet
|
||||
rc_status
|
||||
;;
|
||||
force-reload)
|
||||
## Signal the daemon to reload its config. Most daemons
|
||||
## do this on signal 1 (SIGHUP).
|
||||
## If it does not support it, restart the service if it
|
||||
## is running.
|
||||
|
||||
echo -n "Reload service uacctd "
|
||||
## if it supports it:
|
||||
/sbin/killproc -HUP $NFACCTD_BIN
|
||||
#touch /var/run/uacctd.pid
|
||||
rc_status -v
|
||||
|
||||
## Otherwise:
|
||||
#$0 try-restart
|
||||
#rc_status
|
||||
;;
|
||||
reload)
|
||||
## Like force-reload, but if daemon does not support
|
||||
## signaling, do nothing (!)
|
||||
|
||||
# If it supports signaling:
|
||||
echo -n "Reload service uacctd "
|
||||
/sbin/killproc -HUP $NFACCTD_BIN
|
||||
#touch /var/run/uacctd.pid
|
||||
rc_status -v
|
||||
|
||||
## Otherwise if it does not support reload:
|
||||
#rc_failed 3
|
||||
#rc_status -v
|
||||
;;
|
||||
status)
|
||||
echo -n "Checking for service uacctd "
|
||||
## Check status with checkproc(8), if process is running
|
||||
## checkproc will return with exit status 0.
|
||||
|
||||
# Return value is slightly different for the status command:
|
||||
# 0 - service up and running
|
||||
# 1 - service dead, but /var/run/ pid file exists
|
||||
# 2 - service dead, but /var/lock/ lock file exists
|
||||
# 3 - service not running (unused)
|
||||
# 4 - service status unknown :-(
|
||||
# 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)
|
||||
|
||||
# NOTE: checkproc returns LSB compliant status values.
|
||||
/sbin/checkproc $NFACCTD_BIN
|
||||
# NOTE: rc_status knows that we called this init script with
|
||||
# "status" option and adapts its messages accordingly.
|
||||
rc_status -v
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
rc_exit
|
Reference in New Issue
Block a user