编写SHELL脚本对某目录下指定文件进行监控

2024-11-15 09:58:29
推荐回答(1个)
回答1:

纯手工写出来的啊!
filename=file_`date +%Y%m%d`.txt
filenum=`find /home/oracle -name $filename|wc -l`
if [ $filenum -eq 0 ]
then
echo " file not find! "
else
infonum=`cat /home/oracle/$filename|grep "\^"|wc -l`
if [ $infonum -eq 0 ]
then
echo "^ not find! "
else
echo " file normal! "
fi
fi