f9ee8bcaabd3b5579bc188d48e4c5eee11226ea9
[openwrt/svn-archive/archive.git] / utils / rrdcollect / files / rrdcollect.init
1 #!/bin/sh
2
3 BIN=rrdcollect
4 DEFAULT=/etc/default/$BIN
5 RUN_D=/var/run
6 PID_F=$RUN_D/$BIN.pid
7 LIB_D=/var/lib/rrdcollect
8 CGI_S=$LIB_D/rrd.cgi
9 IMG_D=$LIB_D/img
10 RRD_D=$LIB_D/rrd
11 RRD_F=$(find $RRD_D -name "*.rrd" 2>/dev/null)
12 [ -f $DEFAULT ] && . $DEFAULT
13
14 case $1 in
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 stop)
24 [ -f $PID_F ] && kill $(cat $PID_F)
25 ;;
26 *)
27 echo "usage: $0 (start|stop)"
28 exit 1
29 esac
30
31 exit $?