port over more init scripts
[openwrt/svn-archive/archive.git] / utils / rrdcollect / files / rrdcollect.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006 OpenWrt.org
3
4 BIN=rrdcollect
5 DEFAULT=/etc/default/$BIN
6 RUN_D=/var/run
7 PID_F=$RUN_D/$BIN.pid
8 LIB_D=/var/lib/rrdcollect
9 CGI_S=$LIB_D/rrd.cgi
10 IMG_D=$LIB_D/img
11 RRD_D=$LIB_D/rrd
12 RRD_F=$(find $RRD_D -name "*.rrd" 2>/dev/null)
13 [ -f $DEFAULT ] && . $DEFAULT
14
15 start() {
16 mkdir -p $RUN_D
17 mkdir -p $IMG_D
18 mkdir -p $RRD_D
19 [ -n "$RRD_F" ] || /usr/bin/rrd.sh init
20 [ -x $CGI_S ] || /usr/bin/rrd.sh cgi
21 $BIN $OPTIONS
22 }
23
24 stop() {
25 [ -f $PID_F ] && kill $(cat $PID_F)
26 }
27