summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-statistics/root/etc/init.d/luci_statistics
blob: 68a5cf97a5bf760f6634a7b2977b7d835d33cb9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/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
}