The recent local virtual machine space is always backed up to fill, in order to lazy don't want to log up every day to clear, just write this automatic cleanup script.
System: CentOS 5.x
Script content:
Cat make_room.sh
Copy Code code as follows:
#!/bin/bash
#size = ' Df-hp|grep/dev/mapper/volgroup00-logvol00|awk ' {print $} ' |cut-f 1-d ' G '
Size= ' Df-mp|grep/dev/mapper/volgroup00-logvol00|awk ' {print $} '
File= "/root/sqlbak"
if ["${size}"-le "1000"];then
Rm-f ${file}/*
Else
echo "$size"
Fi
Why not DF-HP, because if the time to judge always error, let me give up the number of decimal point of judgment, directly with a trillion to judge this more accurate. Of course, you can also add other ways to clean up the space, such as deleting the hard disk is larger than the 50-100m file, or delete the first 5-10 large files, these judgments rely on your own to write, these judgments are best not to affect the stability of the server system.