summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a6e74e0)
raw | patch | inline | side by side (parent: a6e74e0)
author | Fabien Wernli <cpan@faxm0dem.org> | |
Thu, 11 Apr 2013 08:43:29 +0000 (10:43 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Thu, 30 May 2013 06:23:27 +0000 (08:23 +0200) |
As collectdmon handles its pidfile, this would require to change
COLLECTMONPIDIR to something else than only-root writeable /var/run
Change-Id: I45d2de9dcc976f3b1e18cef5b6b78eeca1d270b2
Signed-off-by: Florian Forster <octo@collectd.org>
COLLECTMONPIDIR to something else than only-root writeable /var/run
Change-Id: I45d2de9dcc976f3b1e18cef5b6b78eeca1d270b2
Signed-off-by: Florian Forster <octo@collectd.org>
contrib/redhat/init.d-collectd | patch | blob | history |
index ec55a52a55d75e68613e06b35e989601d0d25bd5..52bf7433c8a4732b0251ad4a3ee65f3821aa807f 100644 (file)
service="collectd"
CONFIG=/etc/collectd.conf
COLLECTD=/usr/sbin/collectd
-COLLECTDMONPID=/var/run/collectdmon.pid
+COLLECTDMONPIDIR="/var/run"
+COLLECTDMONPID="$COLLECTDMONPIDIR/collectdmon.pid"
if [ -r /etc/sysconfig/$service ]; then
. /etc/sysconfig/$service
fi
+if [ ! -d $COLLECTDMONPIDIR ]; then
+ mkdir -p $COLLECTDMONPIDIR
+ [ -n "${RUNAS-}" ] && chown $RUNAS: $COLLECTDMONPIDIR
+fi
+
check_config() {
if test ! -r "$CONFIG"; then
return 2
echo $"not starting due to configuration error"
failure $"not starting $service due to configuration error"
else
- daemon $prog -P $COLLECTDMONPID -c $COLLECTD -- -C "$CONFIG" $ARGS
+ daemon --user "${RUNAS-root}" $prog -P $COLLECTDMONPID -c $COLLECTD -- -C "$CONFIG" $ARGS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$service
}
stop () {
echo -n $"Stopping collectd: "
- killproc $prog
+ killproc -p $COLLECTDMONPID $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$service
stop
;;
status)
- status $prog
+ status -p $COLLECTDMONPID $prog
;;
restart|reload)
check_config
fi
;;
condrestart)
- [ -f /var/lock/subsys/$prog ] && restart || :
+ [ -f /var/lock/subsys/$service ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"