summaryrefslogtreecommitdiff
path: root/package/rrdcollect/files/rrdcollect.init
blob: 5c83ae013aac063d0788bbee7e499edd11ed43b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
#PKG rrdcollect
#INIT 90

. /etc/rc.conf

LIB_D=/var/lib/rrdcollect
CGI_S=$LIB_D/rrd.cgi
RRD_D=$LIB_D/rrd
RRD_F=$(find $RRD_D -name "*.rrd" 2>/dev/null)

case $1 in
autostop) ;;
autostart)
	test x"${rrdcollect:-NO}" = x"NO" && exit 0
	exec sh $0 start
	;;
start)
	[ -d $LIB_D/img ] || mkdir -p $LIB_D/img
	[ -n "$RRD_F" ] || /usr/bin/rrd.sh init
	[ -x $CGI_S ] || /usr/bin/rrd.sh cgi
	rrdcollect
	;;
stop)
	pkill rrdcollect
	;;
restart)
	sh $0 stop
	sh $0 start
	;;
*)
	echo "Usage: $0 {start | stop | restart}"
	exit 1
	;;
esac
exit $?