BLUESKY
一步一个脚印向前走
下面的shell语句是可以批量杀死进程包含rec的进程,并且利用awk输出进程号

1 for i in `ps -ef|grep rec|grep -v grep |awk '{print $2}'`
2  do 
3    echo $i 
4    kill -9 $i 
5  done 

下面的语句是删除各个业务文件夹下面的文件
for business in datum 
do

find $SETTLE_DATA
/filter/error_file/$business/    -type f -exec rm {} \;
find $SETTLE_DATA
/filter/index/$business/         -type f -exec rm {} \;
find $SETTLE_DATA
/filter/index_work/$business/    -type f -exec rm {} \;
find $SETTLE_DATA
/filter/repeat/$business/        -type f -exec rm {} \;
find $SETTLE_DATA
/filter/special/$business/       -type f -exec rm {} \;
find $SETTLE_DATA
/filter/rollback/$business/      -type f -exec rm {} \;

done

下面的语句是判断文件夹是否为空
#!/usr/bin/sh

output_message()
{
                
if [ ! -d $SETTLE_DATA/$model/$parent_dir/$business ]
                then
                echo 
"\t\t\t\t\t\t$SETTLE_DATA/$model/$parent_dir/$business is not a directory!";
                
elif [ `ls $SETTLE_DATA/$model/$parent_dir/$business | wc -l` -gt 0 ]
                         then
                echo 
"\t\t\tThe directory $SETTLE_DATA/$model/$parent_dir/$business is not empty!";
                        
else
                echo 
"The directory $SETTLE_DATA/$model/$parent_dir/$business is empty!";
                fi
}

for business in datum
do
                
for model in filter indb
                do
                    
#M-EM-EM-VM-X
                    if [ $model = filter ]
                    then
                                
for parent_dir in error_file index index_work repeat special rollback
                                do
                                   output_message
                                done
                    
#M-HM-kM-?M-b
                    elif [ $model = indb ]
                    then
                                      
for parent_dir in temp notin errin work backup
                                      do
                                                                         output_message
                                      done
                    fi
                done
done
posted on 2007-08-02 01:10 LG 阅读(233) 评论(0)  编辑 收藏 引用 所属分类: UnixProgram

<2007年8月>
2930311234
567891011
12131415161718
19202122232425
2627282930311
2345678

常用链接

相册

最新评论