1.启动脚本时总是要使用 ps -ef | grep "服务名称" 比较烦 后面写了脚本:
LANG=zh_CN.GBK export LANG #ps -ef|grep ServerName | grep -v grep |awk '{print $2}' | xargs kill -9 Process=`ps -ef|grep ServerName|grep -v grep|awk '{print $2}'` #echo $p1 if [ -z $Process ]; then #echo -e "\033[37;31;5m #**************************************************** #* * #* * #* ServerNameProcess number does not exist ! * #* * #* * #**************************************************** #\033[39;49;0m" echo -e "\e[1;31m **************************************************** * * * * * >>>>>> ServerName 进程号不存在 !<<<<<<<<< * * * * * **************************************************** \e[0m" else ps -ef|grep ServerName| grep -v grep |awk '{print $2}' | xargs kill -9 fi rm -rf /weblogic/domains/ServerName/servers/ServerName/tmp/ #判断有木有可解压缩的文件 *.tar if [ -e /weblogic/domains/ServerName/*.tar ];then tar -xf /weblogic/domains/ServerName/*.tar ; sleep 3; echo -e "\e[1;31m------------>>> *.tar 解压缩完毕 !<<<<<-----------------\e[0m "; cp -b /weblogic/domains/ServerName/config/applicationContext.xml /weblogic/domains/ServerName; echo -e "\e[1;31m---------->>>> applicationContext.xml 文件拷贝成功!<<<<<<--------------\e[0m"; rm /weblogic/domains/*.tar ; echo -e "\e[1;31m--------->>>>> *.tar 删除成功!<<<<<<<------------ \e[0m"; else echo -e " \033[1;37;31;5m--->>>>> 指定解压缩的tar包不存在 !<<<<<-------- \033[39;49;0m" fi #sleep 2 echo " _ | | | | _| |_ \ / \ / \_/ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>> >>> >>> 开始启动ServerName服务! >>> >>> >>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " cd /weblogic/domains/ServerName/ nohup sh startWebLogic.sh & sleep 1; tail -f /weblogic/domains/ServerName/nohup.out;