Linux with Operating System Concepts



Download 5,65 Mb.
Pdf ko'rish
bet157/254
Sana22.07.2022
Hajmi5,65 Mb.
#840170
1   ...   153   154   155   156   157   158   159   160   ...   254
Bog'liq
Linux-with-Operating-System-Concepts-Fox-Richard-CRC-Press-2014

soft limits
and 
hard limits
. Hard limits cannot be exceeded and if 
an attempt is made to save a file whose size causes a user to exceed a hard limit, then an 
error will arise. Users are allowed to exceed the soft limits for an amount of time indicated 
by a grace period. Once that grace period has elapsed, the soft limit becomes a hard limit 
until the user reduces his or her storage to again be below the soft limit.
As you can see in the above entry, you are able to establish quotas on both (or either) file 
blocks and inodes. The value 0 indicates no limit.
The grace period can be established on all file systems, a single file system or on indi-
vidual users/groups. For a file system, use 
edquota [–f 
filesystem
]
–t
time
 
where 
time is a value followed by one of seconds, minutes, hours, or days. For instance, 
edquota 
–t 10 hours
would set a grace period of 10 hours for all file systems (or in our case, only 
/home since /home is the only file system with quotas implemented on it).
If you want to issue a different grace period for a specific user or group, use 
edquota 
–T 
username/groupname time
. You can use the option 
unset
in place of a time 
when issuing a grace period on an individual user to indicate that while all other users have 
the grace period as specified via -t, this user has an unlimited grace period.
The edquota command is interactive in that you are dropped into an editor. This may 
create a very onerous task if you had to establish quotas for dozens or hundreds of users. 
Instead, you might prefer to issue quotas from the command line (using command line 
editing) or even more preferable, through a shell script. To accomplish this, you would 
instead use the 
setquota
instruction. The basic form of this instruction is
setquota [–u|–g] 
name bsoft bhard isoft ihard filesystem


The Linux File System

419
where name is the 
user
(or 
group
) name or 
UID
(
GID
), 
bsoft

bhard

isoft
, and 
ihard
are the 
numeric values for the soft limits and hard limits for blocks and inodes, and 
filesystem
is 
the file system that the quota should be implemented on. Use one of -u and -g to indicate 
whether this is being applied to a user (the default) or a group.
What follows is a simple shell script that establishes quotas on all users in /home using 
default values. Notice that 
user
will store the full path of the user’s directory, such as 
/home/foxr. The basename command prunes away the directory portion, leaving just the 
user’s name, so that for instance user will store foxr. As /home may contain content other 
than user directories, we use the condition -d to ensure that 
$user
stores a directory 
name. We will also want to avoid any directory that is not of a user such as lost
+
found.
#!/bin/bash
for user in/home/*; do
user
=
‘basename $user‘
if [[ -d $user && $user !
=
lost
+
found ]]; then
setquota –u $user 1024 1200 100 150 /home
fi
done
This script assigns the same quota values to all users; you could instead create a file of 
user names with the four values to be applied for each user. Another option is to create 
two or more categories of user and establish the common quotas based on the category. 
Implementing a script like this is left as an exercise in the review section.
Two last instructions of note are 
quota
and 
repquota
. These report on the estab-
lished quotas set on users. The instruction 
quota 

Download 5,65 Mb.

Do'stlaringiz bilan baham:
1   ...   153   154   155   156   157   158   159   160   ...   254




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish