summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-statistics/root/etc/init.d/luci_statistics
blob: 55999a8f7fe64e446b643888bb631550e9f260ec (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
#!/bin/sh /etc/rc.common
START=79

start() {
	### replace shipped config with symlink
	if [ ! -L /etc/collectd.conf ]; then
		test -f /etc/collectd.conf && mv /etc/collectd.conf /etc/collectd.conf.bak
		ln -s /var/etc/collectd.conf /etc/collectd.conf
	fi

	### create config
	mkdir -p /var/etc
	/usr/bin/stat-genconfig > /var/etc/collectd.conf

	### prepare rrdimg directory
	if [ ! -L /www/rrdimg ]; then
		imagepath="$(uci get luci_statistics.rrdtool.image_path)"
		ln -s ${imagepath:-/tmp/rrdimg}/ /www/rrdimg
	fi
}

restart() {
        ### regenerate config / prepare environment
        start

        ### restart collectd
        /etc/init.d/collectd restart
}