Script to set different quota depending on User's Group ID
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Ok, say the starting group gid is : 500, and you add 5mb in each case, uou come from 25
Code:
#!/bin/bash
group_from=500
size_inccrement=5
quota_size=25
for group in $(cat /etc/group); do
gid=$(echo $group | cut -d':' -f 3)
name=$(echo $group | cut -d':' -f 1)
if [ "$gid" = "$group_from" ] || [ "$gid" -gt "$group_from" ]; then
# add the command to set quota here
echo "set quota for group $name : $quota_size mb"
let "quota_size+=$size_inccrement"
fi
done
Thank you so much, Cedrik, for your help. I was able to read your scipt and modify it to do what I needed. It is a lillte long, but it does the job.
Thanks again!
-Nett
This is what I came up with:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.