mirror of
https://github.com/myvesta/vesta
synced 2025-08-20 05:14:10 -07:00
Update v-delete-sys-quota
- minor updates - see: v-add-sys-quota
This commit is contained in:
parent
bb037facbb
commit
04f497d932
1 changed files with 22 additions and 17 deletions
|
@ -1,12 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# info: delete system quota
|
# info: delete system quota
|
||||||
# opions: NONE
|
# options: NONE
|
||||||
#
|
#
|
||||||
# The script disables filesystem quota on /home patition
|
# The script disables filesystem quota on /home patition
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
# Variable&Function #
|
# Variable & Function #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Includes
|
# Includes
|
||||||
|
@ -23,29 +23,34 @@ source $VESTA/conf/vesta.conf
|
||||||
# Action #
|
# Action #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Deleting usrquota on /home partition
|
# Deleting group and user quota on /home partition
|
||||||
mnt=$(df -P /home |awk '{print $6}' |tail -n1)
|
mnt=$(df -P /home | awk '{print $6}' | tail -n1)
|
||||||
lnr=$(cat -n /etc/fstab |awk '{print $1,$3}' |grep "$mnt$" |cut -f 1 -d ' ')
|
lnr=$(cat -n /etc/fstab | awk '{print $1,$3}' | grep "$mnt$" | cut -f 1 -d ' ')
|
||||||
options=$(sed -n ${lnr}p /etc/fstab |awk '{print $4}')
|
opt=$(sed -n ${lnr}p /etc/fstab | awk '{print $4}')
|
||||||
if [ ! -z "$(echo $options |grep usrquota)" ]; then
|
fnd='usrquota\|grpquota\|usrjquota=\|grpjquota=\|jqfmt='
|
||||||
sed -i "$lnr s/,usrquota//" /etc/fstab
|
if [ ! -z "$(echo $opt | grep $fnd)" ]; then
|
||||||
|
rep=$(echo $(echo $opt | tr ',' '\n' | grep -v $fnd) | tr ' ' ',')
|
||||||
|
sed -i "$lnr s/$opt/$rep/" /etc/fstab
|
||||||
mount -o remount $mnt
|
mount -o remount $mnt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Disabling fs quota
|
# Disabling group and user quota
|
||||||
if [ -z "$(quotaon -pa|grep " $mnt "|grep user|grep 'off')" ]; then
|
quotaoff=$(which --skip-alias --skip-functions quotaoff 2>/dev/null)
|
||||||
quotaoff $mnt
|
if [ $? -eq 0 ]; then
|
||||||
|
if [ ! -z "$(quotaon -pa | grep " $mnt " | grep 'user\|group' | grep 'is on')" ]; then
|
||||||
|
$quotaoff $mnt
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Deleting quota index
|
# Deleting v1 + v2 group and user quota index
|
||||||
if [ -e "$mnt/aquota.user" ]; then
|
for idx in $(echo 'quota.user quota.group aquota.user aquota.group'); do
|
||||||
rm $mnt/aquota.user
|
[ -e "$mnt/$idx" ] && rm -f $mnt/$idx
|
||||||
fi
|
done
|
||||||
|
|
||||||
# Deleting weekly cron job
|
# Deleting cron job
|
||||||
rm -f /etc/cron.daily/quotacheck
|
rm -f /etc/cron.daily/quotacheck
|
||||||
|
|
||||||
# Updating DISK_QUOTA value
|
# Updating vesta.conf value
|
||||||
if [ -z "$(grep DISK_QUOTA $VESTA/conf/vesta.conf)" ]; then
|
if [ -z "$(grep DISK_QUOTA $VESTA/conf/vesta.conf)" ]; then
|
||||||
echo "DISK_QUOTA='no'" >> $VESTA/conf/vesta.conf
|
echo "DISK_QUOTA='no'" >> $VESTA/conf/vesta.conf
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue