Advertisement
johnnyfartpants0

set zfs user quotas based on directory filename

May 16th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. if [ $# -ne 2 ];
  4. then
  5. echo "setquota size target_directory"
  6. exit;
  7. fi
  8.  
  9. if [ ! -d "$2" ];
  10. then
  11. echo $2" is not a directory";
  12. exit;
  13. fi
  14.  
  15. size=$1;
  16. target_dir=$2;
  17. cd $target_dir;
  18.  
  19. for d in `ls -d */`
  20. do
  21. cmd="zfs set userquota@"${d%?}"="$size" "tank/home
  22. echo $cmd;
  23. $cmd;
  24. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement