View | Details | Raw Unified | Return to bug 199133 | Differences between
and this patch

Collapse All | Expand All

(-)net/vnstat/files/pkg-message.in (-1 / +8 lines)
Lines 1-7 Link Here
1
###########################################################################
1
###########################################################################
2
vnstat has been installed.
2
vnstat has been installed.
3
3
4
A Sample configuration file has be installed in %%PREFIX%%/etc/
4
A sample configuration file has be installed in %%PREFIX%%/etc/
5
Please add your default network interface in the 'Interface' line there
6
before starting vnstat service.
7
You can add any number of additional interfaces either in
8
vnstat_additional_ifaces variable in /etc/rc.conf, or with this command:
9
su -m %%USERS%% -c "%%PREFIX%%/bin/vnstat --create --iface <your interface>"
10
and restart vnstat service:
11
service vnstat restart
5
12
6
For more information about vnStat use "man vnstat" or visit:
13
For more information about vnStat use "man vnstat" or visit:
7
http://humdi.net/vnstat/
14
http://humdi.net/vnstat/
(-)net/vnstat/files/vnstat.in (+24 lines)
Lines 22-36 Link Here
22
: ${vnstat_flags="-d --noadd"}
22
: ${vnstat_flags="-d --noadd"}
23
: ${vnstat_user:=%%USERS%%}
23
: ${vnstat_user:=%%USERS%%}
24
: ${vnstat_group:=%%GROUPS%%}
24
: ${vnstat_group:=%%GROUPS%%}
25
: ${vnstat_additional_ifaces:=""}
25
26
26
command="%%PREFIX%%/sbin/vnstatd"
27
command="%%PREFIX%%/sbin/vnstatd"
27
command_args="-p ${vnstat_pidfile} --config ${vnstat_config}"
28
command_args="-p ${vnstat_pidfile} --config ${vnstat_config}"
28
pidfile="${vnstat_pidfile}"
29
pidfile="${vnstat_pidfile}"
30
user_cmd="%%PREFIX%%/bin/vnstat"
29
31
30
start_precmd=vnstat_startprecmd
32
start_precmd=vnstat_startprecmd
31
33
34
create_iface_database() {
35
	local iface="$1"
36
	local descr="$2"
37
	su -m ${vnstat_user} -c "${user_cmd} --create --iface $iface" >/dev/null 2>&1 ||
38
	  ! echo "$name: Failed to create database for the $descr interface $iface" || return 1
39
	echo "$name: Created the database for the $descr interface $iface"
40
}
41
32
vnstat_startprecmd()
42
vnstat_startprecmd()
33
{
43
{
44
	local dbdir iface
45
34
	if [ ! -e ${pidfile%/*} ]; then
46
	if [ ! -e ${pidfile%/*} ]; then
35
		install -d -o ${vnstat_user} -g ${vnstat_group} ${pidfile%/*};
47
		install -d -o ${vnstat_user} -g ${vnstat_group} ${pidfile%/*};
36
	fi
48
	fi
Lines 40-45 Link Here
40
		install -d -o ${vnstat_user} -g ${vnstat_group} ${dbdir};
52
		install -d -o ${vnstat_user} -g ${vnstat_group} ${dbdir};
41
	fi
53
	fi
42
54
55
	iface=$(grep "^Interface" ${vnstat_config} | head -1 | awk 'BEGIN{FS="\042"}{print $2}')
56
	if [ -n "${iface}" -a ! -f ${dbdir}/${iface} ]; then
57
		create_iface_database $iface "default" || return 1
58
	fi
59
	if [ -n "${vnstat_additional_ifaces}" ]; then
60
		for iface in ${vnstat_additional_ifaces}; do 
61
			if [ ! -f ${dbdir}/${iface} ]; then
62
				create_iface_database $iface "additional" || return 1
63
			fi
64
		done
65
	fi
66
43
	if [ ! -d "/var/run/vnstat" ]; then
67
	if [ ! -d "/var/run/vnstat" ]; then
44
		install -d -o ${vnstat_user} -g ${vnstat_group} /var/run/vnstat;
68
		install -d -o ${vnstat_user} -g ${vnstat_group} /var/run/vnstat;
45
	fi
69
	fi

Return to bug 199133