Guest User

Untitled

a guest
Mar 17th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.56 KB | None | 0 0
  1. #!/bin/sh
  2. # fquota - Disk quota analysis tool for Unix.
  3. #
  4. Assumes that all user accounts are >= UID 100.
  5. MAXDISKUSAGE=20
  6. for name in $(cut -d: -f1,3 /etc/passwd | awk -F: '$2 > 99 {print $1}')
  7. do
  8. echo -n "User $name exceeds disk quota. Disk usage is: "
  9. # You might need to modify the following list of directories to match
  10. # the layout of your disk. Most likely change: /Users to /home
  11. find / /usr /var /Users -user $name -xdev -type f -ls | \
  12. awk '{ sum += $7 } END { print sum / (1024*1024) " Mbytes" }'
  13. done | awk "\$9 > $MAXDISKUSAGE { print \$0 }"
  14. exit 0
Add Comment
Please, Sign In to add comment