# Source function library.
. /etc/rc.d/init.d/functions
+# Get config
+. /etc/sysconfig/munin-asyncd
+
+# Set defaults in case they're not defined in config
+MUNIN_NODE_HOST=${MUNIN_NODE_HOST:-localhost}
+MUNIN_NODE_PORT=${MUNIN_NODE_HOST:-4949}
+MUNIN_ASYNCD_SHUTDOWN_TIMEOUT=${MUNIN_ASYNCD_SHUTDOWN_TIMEOUT:-15}
+
start() {
# Check if the service is already running?
if [ -f /var/lock/subsys/munin-asyncd ]; then
fi
msg_starting "munin-asyncd"
- daemon /usr/sbin/munin-asyncd
+ daemon --fork /usr/sbin/munin-asyncd --host ${MUNIN_NODE_HOST}:${MUNIN_NODE_PORT}
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/munin-asyncd
}
fi
msg_stopping "munin-asyncd"
- killproc munin-asyncd
+ busy
+ # We can't kill by process name, asyncd is changing it dynamically
+ # so we simply send TERM to all asyncd processes
+ for ppid in $(pgrep "^munin-asyncd "); do
+ kill -TERM ${ppid}
+ done
+ timeout=0
+ while pgrep "^munin-asyncd " 1>/dev/null 2>&1; do
+ # If timeout was reached send kill signal and break loop
+ if [ $timeout -ge $MUNIN_ASYNCD_SHUTDOWN_TIMEOUT ]; then
+ for ppid in $(pgrep "^munin-asyncd "); do
+ kill -KILL ${ppid}
+ done
+ break
+ fi
+ sleep 1
+ timeout=$((timeout+1))
+ done
+ ok
rm -f /var/lock/subsys/munin-asyncd
}
-# TODO
-# - R: perl* should be autogenerated?
-# - add plugins-java package and proper BRs
-#
# Condtional build:
%bcond_with sybase # add Sybase support to munin-node
Source6: %{name}-lighttpd.conf
Source8: %{name}-httpd.conf
Source11: %{name}-asyncd.init
+Source12: %{name}-asyncd.sysconfig
Patch0: %{name}-Makefile.patch
Patch1: %{name}-plugins.patch
Patch2: %{name}-templatedir.patch
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,cron.d,logrotate.d},%{_bindir},%{_sbindir}} \
+install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,cron.d,logrotate.d,sysconfig},%{_bindir},%{_sbindir}} \
$RPM_BUILD_ROOT/var/log/archive/munin \
$RPM_BUILD_ROOT%{_webapps}/%{_webapp}
# move asyncd daemon do sbin
%{__mv} $RPM_BUILD_ROOT{%{_datadir}/munin,%{_sbindir}}/munin-asyncd
-install -p %{SOURCE11} $RPM_BUILD_ROOT/etc/rc.d/init.d/munin-asyncd
install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/munin-node
+install -p %{SOURCE11} $RPM_BUILD_ROOT/etc/rc.d/init.d/munin-asyncd
+install %{SOURCE12} $RPM_BUILD_ROOT/etc/sysconfig/munin-asyncd
+
cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/cron.d/munin
cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/logrotate.d/munin
cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/munin-node
cp -p %{SOURCE8} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
+
cp -p dists/tarball/plugins.conf $RPM_BUILD_ROOT%{_sysconfdir}
ln -sf %{_sysconfdir}/plugins.conf $RPM_BUILD_ROOT%{_sysconfdir}/plugin-conf.d/munin-node
%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/plugins.conf
%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/plugin-conf.d/munin-node
%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/munin-node
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/munin-asyncd
%attr(754,root,root) /etc/rc.d/init.d/munin-asyncd
%attr(754,root,root) /etc/rc.d/init.d/munin-node
%attr(755,root,root) %{_bindir}/munindoc
%{_mandir}/man3/Munin::Node*
%{_mandir}/man3/Munin::Plugin*
%{_mandir}/man5/munin-node.conf*
-
-#%files plugins-java
-#%defattr(644,root,root,755)
-#%{_datadir}/munin/munin-jmx-plugins.jar