#!/bin/sh for p in ./* do if test -d $p then touch $p".ok" if test -f $p"/busi.xml" then echo "delete ${p}/busi.xml..." rm $p"/busi.xml" fi for z in $(find $p -name "*.zip") do echo "delete ${z}..." rm $z done fi done
#!/bin/sh while true do read -p "please input look or restart servername:" cmd if [ "look" = "$cmd" ] then ps -ef | grep java | awk ‘ function add(a , st , lee , vv , sv , slen , subss , arrs) { match(a , /Dweblogic.Name=([^ ]+)/); vv = substr(a ,RSTART,RLENGTH); split(vv , arrs , "="); if(arrs[2]){ print arrs[2]; } } { add($0);}‘ else strRes=`echo $cmd | awk -F ‘ ‘ ‘{print $2;}‘` strCmd=`echo $cmd | awk -F ‘ ‘ ‘{print $1;}‘` if [ $strCmd = "restart" ] then strPid=0 echo `ps -ef | grep java | awk ‘ function addr(a , st , lee , vv , sv , slen , subss , arrs) { lee = "Dweblogic.Name="st if(index(a , lee) > 0){ print a; } } { addr($0 , strRes);}‘ strRes="$strRes" | awk -F ‘ ‘ ‘{print $2}‘` > pid.temp # echo `cat pid.temp` strPid=$(cat pid.temp) kill -9 $strPid sd=$(`echo find ~/user_projects -name $strRes`) cd $sd rm -rf ./tmp cd ../../bin ls -l read -p "please input start sh name:" shcus ./$shcus".sh" echo $shcus" is start..." cd ~/nohuplog ls -l read -p "please input rizhi name:" shcusrizhi tail -200f $shcusrizhi".log" fi # end if [ $strCmd = "restart" ] fi done
脚本1 , 在同级目录,根据文件夹创建ok 文件。
脚本2 , 杀进程,启动服务。
时间: 2024-11-08 20:29:04