--- /dev/null
+#!/bin/sh
+#
+# rrdcached This shell script takes care of starting and stopping
+# the rrdcached.
+#
+# chkconfig: 2345 19 81
+# description: It comes by night and sucks the vital essence from your computers.
+#
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+[ -f /etc/sysconfig/rrdcached ] && . /etc/sysconfig/rrdcached
+
+# Set defaults if not defined in service config file
+RRDCACHED_WRITE_TIMEOUT=${RRDCACHED_WRITE_TIMEOUT:-300}
+RRDCACHED_WRITE_DELAY=${RRDCACHED_WRITE_DELAY:-180}
+RRDCACHED_WRITE_THREADS=${RRDCACHED_WRITE_THREADS:-4}
+RRDCACHED_PID_FILE="/var/run/rrdcached.pid"
+RRDCACHED_SOCKET="/var/run/rrdcached.sock"
+
+start() {
+ # Check if the service is already running?
+ if [ -f /var/lock/subsys/rrdcached ]; then
+ msg_already_running "rrdcached"
+ return
+ fi
+
+ msg_starting "rrdcached"
+ daemon /usr/bin/rrdcached -m 0660 -w ${RRDCACHED_WRITE_TIMEOUT} -z ${RRDCACHED_WRITE_DELAY} -t ${RRDCACHED_WRITE_THREADS} -p ${RRDCACHED_PID_FILE} -l ${RRDCACHED_SOCKET}
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/rrdcached
+}
+
+stop() {
+ if [ ! -f /var/lock/subsys/rrdcached ]; then
+ msg_not_running "rrdcached"
+ return
+ fi
+
+ # Stop daemons.
+ msg_stopping "rrdcached"
+ killproc /usr/sbin/rrdcached
+ rm -f /var/lock/subsys/rrdcached
+}
+
+condrestart() {
+ if [ ! -f /var/lock/subsys/rrdcached ]; then
+ msg_not_running "rrdcached"
+ RETVAL=$1
+ return
+ fi
+
+ stop
+ start
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ status)
+ status rrdcached
+ RETVAL=$?
+ ;;
+*)
+ msg_usage "$0 {start|stop|restart|status}"
+ exit 3
+ ;;
+esac
+exit $RETVAL
Summary(uk.UTF-8): RRDtool - це система зберігання та показу серійних даних
Name: rrdtool
Version: 1.8.0
-Release: 1
+Release: 0.1
License: GPL v2+ + FLOSS exception
Group: Applications/Databases
Source0: https://github.com/oetiker/rrdtool-1.x/releases/download/v%{version}/%{name}-%{version}.tar.gz
# Source0-md5: 852754364cbd0703a099b5eb32932851
+Source1: rrdcached.init
+Source2: rrdcached.sysconfig
Patch0: %{name}-tcl-path.patch
Patch1: groff.patch
URL: http://oss.oetiker.ch/rrdtool/
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
+install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,sysconfig},%{_examplesdir}/%{name}-%{version}}
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT \
examplesdir=%{_examplesdir}/%{name}-%{version} \
RUBYARCHDIR=$RPM_BUILD_ROOT%{ruby_archdir}
+install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/rrdcached
+install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/rrdcached
+
%{__rm} $RPM_BUILD_ROOT%{_libdir}/librrd.la
%{__rm} -r $RPM_BUILD_ROOT%{_docdir}
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
+%pre cached
+%groupadd -g 347 rrdcached
+%useradd -u 347 -d /usr/share/empty -g rrdcached -c "rrdcached daemon user" rrdcached
+
+%post cached
+/sbin/chkconfig --add rrdcached
+%service rrdcached restart
+
+%postun cached
+if [ "$1" = "0" ]; then
+ %userremove rrdcached
+ %groupremove rrdcached
+fi
+
+%preun cached
+if [ "$1" = "0" ]; then
+ %service rrdcached stop
+ /sbin/chkconfig --del rrdcached
+fi
+
%files
%defattr(644,root,root,755)
%doc CHANGES CONTRIBUTORS COPYRIGHT NEWS THREADS TODO
%files devel
%defattr(644,root,root,755)
%attr(755,root,root) %{_libdir}/librrd.so
+%attr(754,root,root) /etc/rc.d/init.d/rrdcached
+%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/rrdcached
%{_includedir}/rrd*.h
%{_pkgconfigdir}/librrd.pc
%{_mandir}/man3/librrd.3*