linux下应用软件突然丢失的的故障
问题描述:
某小系统早上发现应用软件被删除了,系统无法正常运行,相关人员均为找到原因.OS本版是RHEL6
1,登录主机发现,/dev/sdb1同时挂载了两个文件系统,注意/tmp也被mount
[plain]
[root@localhost ~]# df -h
文件系统 容量 已用 可用 已用%% 挂载点
/dev/mapper/VolGroup-lv_root
14G 6.8G 6.0G 54% /
tmpfs 4.0G 176K 4.0G 1% /dev/shm
/dev/sda1 485M 51M 409M 11% /boot
<span style="color:#FF0000">/dev/sdb1 40G 8.5G 29G 23% /spmwls
/dev/sdb1 40G 8.5G 29G 23% /tmp</span>
2,操作系统会每天删除/tmp目录下的文件,应该是默认删除10天前的文件,所以/spmwls安装的中间件软件按被系统删除了
[plain]
[root@localhost cron.daily]# pwd
/etc/cron.daily
[root@localhost cron.daily]# cat /etc/cron.daily/tmpwatch
#! /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" 30d /var/tmp
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
if [ -d "$d" ]; then
/usr/sbin/tmpwatch "$flags" -f 30d "$d"
fi
done
3,再看cron的执行日志
[plain]
Oct 10 03:11:03 localhost run-parts(/etc/cron.daily)[62997]: starting tmpwatch
Oct 10 03:11:04 localhost run-parts(/etc/cron.daily)[63215]: finished tmpwatch
<strong>删除部分文件失败的日志
</strong>
/etc/cron.daily/tmpwatch:
error: failed to rmdir /tmp/weblogic1036/user_projects/domains/cmb/lib: Device or resource busy
4,备注: RHEL 6的cron的执行原理
RHEL6 中 cron daily的执行有了变化,通过man命令,可以得到cron执行的具体内容
a、/var/spool/cron目录下的文件,这个目录下和用crontab -l命令查看处理的相同
b、/etc/cron.d目录下的文件
c、/etc/anacrontab文件中的内容,本次的tmpwatch就是通过这个文件执行的,这个文件会在3点钟开始执行
[plain]
[root@localhost lib]# cat /etc/anacrontab
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22
#period in days delay in minutes job-identifier command
1 5 cron.daily nice run-parts /etc/cron.daily
7 25 cron.weekly nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly nice run-parts /etc/cron.monthly
man cron
Cron searches /var/spool/cron for crontab files which are named after accounts in /etc/passwd; The founded crontabs are loaded into memory. Cron also
searches for /etc/anacrontab and the files in the /etc/cron.d directory,