|
使用sync命令将所有未写的系统缓存区write to disk,包含已修改的i node、已延迟的块I\O和读写映射
sync
cat /proc/sys/vm/drop_caches
echo 3 > /proc/sys/vm/drop_caches[可以将3修改为别的 1清空页缓存 2清空inode和目录树缓存 3清空所有的缓存]
清理tmp命令:
find /tmp/ -name "p*" | xargs rm -rf
yum -y install crontabs
修改etc/crontab文件为以下
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
10 * * * * root echo 3 > /proc/sys/vm/drop_caches
10 1 * * * root find /tmp/ -name "p*" | xargs rm -rf
设置每天清理一次tmp文件夹
修改/etc/cron.daily/tmpwatch[30d修改为1d]
#! /bin/sh
flags=-umc
/usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \
-x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix \
-X '/tmp/hsperfdata_*' 10d /tmp
/usr/sbin/tmpwatch "$flags" 10d /var/tmp
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
if [ -d "$d" ]; then
/usr/sbin/tmpwatch "$flags" -f 10d "$d"
fi
done
----------------------------------------------
本文章来自肖俊杰的博客
http://blog.51cto.com/13504390
QQ :122501162
邮箱:zzzdlx@126.com |
|
|