luci-0.9: merge r5693 and r5697
This commit is contained in:
parent
699c9b1e97
commit
45b90e8686
3 changed files with 33 additions and 28 deletions
|
@ -8,7 +8,7 @@ config 'statistics' 'collectd'
|
|||
option 'Include' '/etc/collectd/conf.d'
|
||||
option 'PIDFile' '/var/run/collectd.pid'
|
||||
option 'PluginDir' '/usr/lib/collectd'
|
||||
option 'TypesDB' '/usr/lib/collectd/types.db'
|
||||
option 'TypesDB' '/usr/share/collectd/types.db'
|
||||
option 'Interval' '30'
|
||||
option 'ReadThreads' '2'
|
||||
|
||||
|
|
|
@ -1,27 +1,6 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
START=79
|
||||
|
||||
boot() {
|
||||
### prepare publisher
|
||||
if ! uci get lucid.rrdimg >/dev/null 2>/dev/null; then
|
||||
uci batch <<-EOF
|
||||
set lucid.rrdimg=DirectoryPublisher
|
||||
set lucid.rrdimg.name='Statistics Images'
|
||||
set lucid.rrdimg.physical=/tmp/rrdimg
|
||||
set lucid.rrdimg.virtual=/rrdimg
|
||||
set lucid.rrdimg.domain=''
|
||||
|
||||
add_list lucid.http.publisher=rrdimg
|
||||
add_list lucid.https.publisher=rrdimg
|
||||
|
||||
commit lucid
|
||||
EOF
|
||||
/etc/init.d/lucid restart
|
||||
fi
|
||||
|
||||
start
|
||||
}
|
||||
|
||||
start() {
|
||||
### replace shipped config with symlink
|
||||
if [ ! -L /etc/collectd.conf ]; then
|
||||
|
@ -34,15 +13,13 @@ start() {
|
|||
/usr/bin/stat-genconfig > /var/etc/collectd.conf
|
||||
|
||||
### prepare rrdimg directory
|
||||
if [ "$(uci get luci_statistics.rrdtool.image_path 2>/dev/null)" != "$(uci get lucid.rrdimg.physical 2>/dev/null)" ]; then
|
||||
uci set lucid.rrdimg.physical=$(uci get luci_statistics.rrdtool.image_path)
|
||||
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
|
||||
|
||||
### flush LuCI index cache
|
||||
test -f /var/luci-indexcache && rm /var/luci-indexcache
|
||||
|
||||
### workaround broken permissions on /tmp
|
||||
chmod 1777 /tmp
|
||||
}
|
||||
|
|
|
@ -1,7 +1,35 @@
|
|||
#!/bin/sh
|
||||
|
||||
uci batch <<-EOF
|
||||
# register commit handler
|
||||
[ -f /etc/config/ucitrack ] && \
|
||||
[ "$(uci get ucitrack.@luci_statistics[0] 2>/dev/null)" != "luci_statistics" ] && \
|
||||
uci batch <<-EOF >/dev/null 2>/dev/null
|
||||
add ucitrack luci_statistics
|
||||
set ucitrack.@luci_statistics[-1].init=luci_statistics
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
# register LuCId virtual path handler
|
||||
[ -f /etc/config/lucid ] && \
|
||||
[ "$(uci get lucid.statistics 2>/dev/null)" != "DirectoryPublisher" ] && \
|
||||
uci batch <<-EOF >/dev/null 2>/dev/null
|
||||
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
|
||||
|
||||
exit 0
|
||||
|
|
Loading…
Reference in a new issue