* luci/statistics: implement reload action in init script
[project/luci.git] / applications / luci-statistics / root / etc / init.d / luci_statistics
1 #!/bin/sh /etc/rc.common
2 START=79
3
4 start() {
5 ### replace shipped config with symlink
6 if [ ! -L /etc/collectd.conf ]; then
7 test -f /etc/collectd.conf && mv /etc/collectd.conf /etc/collectd.conf.bak
8 ln -s /var/etc/collectd.conf /etc/collectd.conf
9 fi
10
11 ### create config
12 mkdir -p /var/etc
13 /usr/bin/stat-genconfig > /var/etc/collectd.conf
14
15 ### prepare rrdimg directory
16 if [ ! -L /www/rrdimg ]; then
17 imagepath="$(uci get luci_statistics.rrdtool.image_path)"
18 ln -s ${imagepath:-/tmp/rrdimg}/ /www/rrdimg
19 fi
20 }
21
22 restart() {
23 ### regenerate config / prepare environment
24 start()
25
26 ### restart collectd
27 /etc/init.d/collectd restart
28 }