- 论坛徽章:
- 0
|
各位linux高手,我一个菜鸟想写一个程序,使得home下面的各个账户的大小超过100G就提出警告。但是,不知道错误的地方怎么改,请高手们指教一下
#maxinum file size
alarmrange=100
#dir of working
work_dir=/home
#the list of zhang hu
zhanghu_list=/home/check/zhanghu.txt
#This is the frequency our program runs
sleep_time=100
check_process()
{
for zhanghu in `cat ${zhanghu_list}`
do
size = `du -sh ${work_dir}/${zhanghu} | awk '{print $1}'`
if [ size -gt alarmrange ];then
echo "Your file was too large (larger than 100G), Please delete the needless file " > ${work_dir}/${zhanghu}/Desktop/Warning.txt
echo ${zhanghu} > ${work_dir}/check/large_zhanghu.txt
else
break;
fi
done
}
while true ;do
check_process
sleep $sleep_time
done
check.rar
(808 Bytes, 下载次数: 2)
|
|