2006-10-04 20:57:49 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
2010-02-28 01:50:39 +00:00
|
|
|
# Copyright (C) 2006-2010 OpenWrt.org
|
2006-08-01 11:52:57 +00:00
|
|
|
|
2006-10-15 21:03:30 +00:00
|
|
|
START=80
|
2006-08-01 11:52:57 +00:00
|
|
|
BINARY="/usr/sbin/collectd"
|
|
|
|
PIDFILE="/var/run/collectd.pid"
|
|
|
|
DATADIR="/var/lib/collectd"
|
|
|
|
|
2006-10-04 20:57:49 +00:00
|
|
|
start() {
|
2010-02-28 01:50:39 +00:00
|
|
|
[ -x "$BINARY" ] || exit 1
|
2006-10-04 20:57:49 +00:00
|
|
|
[ -d "$DATADIR" ] || mkdir -p "$DATADIR";
|
2006-08-01 11:52:57 +00:00
|
|
|
|
2010-02-28 01:50:39 +00:00
|
|
|
rm -f $PIDFILE
|
|
|
|
start-stop-daemon -S -q -b -x $BINARY -m -p $PIDFILE -- -f
|
2006-10-04 20:57:49 +00:00
|
|
|
}
|
2006-08-01 11:52:57 +00:00
|
|
|
|
2006-10-04 20:57:49 +00:00
|
|
|
stop() {
|
2010-02-28 01:50:39 +00:00
|
|
|
[ -s "$PIDFILE" ] && {
|
|
|
|
local pid="$(cat $PIDFILE)"
|
|
|
|
|
|
|
|
start-stop-daemon -K -q -n ${BINARY##*/} -p $PIDFILE
|
2007-07-15 19:43:45 +00:00
|
|
|
|
2010-02-28 01:50:39 +00:00
|
|
|
for i in 1 2 3 4 5; do
|
|
|
|
kill -0 $pid 2>/dev/null || return
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
}
|
2007-07-15 19:43:45 +00:00
|
|
|
}
|