blob: b33536441e0ac86e34c1315bb3c79a5de1b62e29 (
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#!/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
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 [ "$(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)
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
}
restart() {
### regenerate config / prepare environment
start
### restart collectd
/etc/init.d/collectd restart
}
|