start() {
### replace shipped config with symlink
+ mkdir -p /var/etc
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 [ -f /etc/config/lucid ] && [ -x /etc/init.d/lucid ] && /etc/init.d/lucid enabled && \
- [ "$(uci get luci_statistics.rrdtool.image_path 2>/dev/null)" != "$(uci get lucid.statistics.physical 2>/dev/null)" ]; then
- uci set lucid.statistics.physical=$(uci get luci_statistics.rrdtool.image_path)
- uci commit lucid
- /etc/init.d/lucid restart
- fi
-
### workaround broken permissions on /tmp
chmod 1777 /tmp
}
commit ucitrack
EOF
-# register LuCId virtual path handler
-[ -f /etc/config/lucid ] && \
-uci -q batch <<-EOF >/dev/null
- delete lucid.statistics
-
- set lucid.statistics=DirectoryPublisher
- set lucid.statistics.name='RRDTool Image Cache'
- set lucid.statistics.physical=/tmp/rrdimg
- set lucid.statistics.virtual=/rrdimg
- set lucid.statistics.domain=''
-
- add_list lucid.http.publisher=statistics
- add_list lucid.https.publisher=statistics
-
- commit lucid
-EOF
-
# symlink for busybox httpd
[ -x /usr/sbin/httpd ] && [ ! -h /www/rrdimg ] && \
ln -s /tmp/rrdimg /www/rrdimg
-# restart LuCId service
-[ -x /etc/init.d/lucid ] && /etc/init.d/lucid enabled && /etc/init.d/lucid restart
-
rm -f /tmp/luci-indexcache
exit 0