cleardisk.sh

#! /bin/sh

function del_larger_file()

{

curruser=$1

find /home/$curruser -name "*log*" -type f -size +10M;

find /home/$curruser -name "*log*" -type f -size +10M -exec rm -f {} ;

}

function show_user_space()

{

curruser=$1

du -h /home/$curruser | tail -n 1

}

var=`ls /home`

var=${var// / }

echo "check and delete log file big than 20M"

for element in $var

do

if [ "$element" = "oracle" ]; then

continue

fi

 

del_larger_file $element

done

echo "static space cost for every user"

for element in $var

do

show_user_space $element

done

 

date

原文地址:https://www.cnblogs.com/skiing886/p/9327372.html