按照某一固定用户的磁盘配额增加用户的shell script

#!/bin/bash
#Shell name: quota_users.sh
#
#Program:
# create disk-quotas for some users by using the same user
#Author: pero
#Email:  [email protected]
#
#History:
# 2012/8/12
#Usage: vi quota_users.sh :set ff=unix ./quota.sh
#
#If you have any opinion please contact me

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:.
export PATH

if [ $UID -ne 0 ]
then
  echo "Run as root"
  exit 77
fi

read -p "Please input a name of user who had disk-quotas :" suser

exist=$(quota -u $suser &> /dev/null)

if [ $? -ne 0 ]
then
 echo "$suser is not exist"
 exit 77
fi

read -p "Please input some name of users whom want to having $suser disk-quotas with space to partitioning: " user

edquota -p $suser -u $user

if [ $? -eq 0 ]
then
 echo "It's ok!!!"
fi

你可能感兴趣的:(shell,script)