From f543e20ec4fd992c8f5b2683b1789f6c616dcdff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Tue, 19 Jul 2022 15:22:26 +0200 Subject: [PATCH] Update help message --- zfs/zfs.set.user.quota.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/zfs/zfs.set.user.quota.sh b/zfs/zfs.set.user.quota.sh index 94353c2..a6fc662 100755 --- a/zfs/zfs.set.user.quota.sh +++ b/zfs/zfs.set.user.quota.sh @@ -44,10 +44,16 @@ EXAMPLES : - Apply default quota to a given dataset ${PROGNAME} --pool "datastore/backup" + - Apply a given quota by default (100G) and use a quota file for specific user + ${PROGNAME} --quota 100G --file /datastore/backup/.duplicati/zfs.quota + OPTIONS : -d,--debug Enable debug messages. + -f|--file + Specify path to a quota file for specific quota per user. + -h,--help Print this help message. @@ -303,15 +309,16 @@ main() { # {{{ ## Read user one by one while IFS= read -r zfs_username; do - ### Get quota to use {{{ + ### Define quota to use {{{ if [ "${QUOTA_FILE_MODE}" -eq "0" ] \ && grep --word-regexp -- "^${zfs_username}" "${quota_file}" | grep --only-matching --perl-regexp --quiet -- '[[:digit:].]*.$'; then + ### From quota file if any information for this user user_zfs_quota="$(grep --word-regexp -- "^${zfs_username}" "${quota_file}" | grep --only-matching --perl-regexp -- '[[:digit:].]*.$' \ || error_message "Can't get quota for ${zfs_username} user from ${quota_file} quota file." 4)" - debug_message "Apply specific quota (${RED}${user_zfs_quota}${COLOR_DEBUG}) to ${zfs_username} user." - exit 0 + debug_message "Get specific quota (${RED}${user_zfs_quota}${COLOR_DEBUG}) for ${RED}${zfs_username}${COLOR_DEBUG} user from quota file (${RED}${quota_file}${COLOR_DEBUG})." else + ### Default quota by default user_zfs_quota="${zfs_quota}" fi ### }}}