From: François Tigeot Date: Sun, 15 Jan 2012 21:33:08 +0000 (+0100) Subject: rc.d: Add a vfs_accounting script X-Git-Tag: v3.0.0~73 X-Git-Url: https://gitweb.dragonflybsd.org/~tuxillo/dragonfly.git/commitdiff_plain/9be2bba083772211049aa695fd8e9dedd239e0e4 rc.d: Add a vfs_accounting script * Its only function for now is to synchronize counters with the real disk usage of a list of mount points * Small rc.conf example: vfs_accounting_enable="YES" vfs_accounting_sync="/home /mnt/data" --- diff --git a/etc/rc.d/vfs_accounting b/etc/rc.d/vfs_accounting new file mode 100644 index 0000000000..58436aa600 --- /dev/null +++ b/etc/rc.d/vfs_accounting @@ -0,0 +1,36 @@ +#!/bin/sh + +# PROVIDE: vfs_accounting +# REQUIRE: mountcritlocal +# BEFORE: LOGIN + +. /etc/rc.subr + +name="vfs_accounting" +rcvar=`set_rcvar` +start_cmd="vas_start" + +vas_start() +{ + if checkyesno vfs_accounting_enable; then + # For each dir in $vfs_accounting_sync, run vquota sync + # + case ${vfs_accounting_sync} in + [Nn][Oo] | '') + ;; + *) + echo -n 'Synchronizing VFS counters: ' + for dir in ${vfs_accounting_sync}; do + echo -n "${dir} " + if [ -d "${dir}" ]; then + /sbin/vquota sync ${dir} + fi + done + echo '.' + ;; + esac + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index 9c76a23c86..ee40869f6a 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -2661,6 +2661,16 @@ has not completed within the specified time (in seconds). If set to .Dq Li YES , the udevd daemon will be started on boot. +.It Va vfs_accounting_enable +.Pq Vt bool +If set to +.Dq Li YES , +vfs accounting rc.d scripts will be run on boot. +.It Va vfs_accounting_sync +.Pq Vt str +List of mount points whose counters are to be synchronized with on-disk +usage during system startup. See also +.Xr vquota 8 . .It Va vknetd_enable .Pq Vt bool If set to