给setenv.sh增加-XX:+UseCompressedOops

前端之家收集整理的这篇文章主要介绍了给setenv.sh增加-XX:+UseCompressedOops前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

下面是编程之家 jb51.cc 通过网络收集整理的代码片段。

编程之家小编现在分享给大家,也给大家做个参考。

#!/bin/bash
#Program:
#    在每个tomcat下的bin里创建setenv.sh

#1.输入目录
read -p "请输入shequ的目录:" dir
if [ ${dir} == "" -o ! -d ${dir} ]; then 
    echo "$dir 不存在"
    exit 1
fi

#为每个目录下创建sentenv.sh
dirList=$(ls -d ${dir}/*/bin )
for binDir in $dirList
do
    #没有就创建setenv.sh
    fileName=${binDir}/setenv.sh
    if [ ! -f fileName ]; then
      touch ${fileName}
    fi
    temp=$(cat ${fileName})
    
    count1=$(echo ${temp}|grep -c 'JAVA_OPTS')
    count2=$(echo ${temp}|grep -c 'UseCompressedOops')
   # echo ${fileName}${count1}${count2}
    if [ ${count1} == '1' ] &&  [ ${count2} == '0' ]; then 
       temp=$(echo ${temp}|sed 's/"$/ -XX:+UseCompressedOops"/g')
    elif [ ${count1} == '0' ]; then
       temp='JAVA_OPTS="$JAVA_OPTS -XX:+UseCompressedOops"'
    fi
    
    echo ${temp}>${fileName}
done 

以上是编程之家(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。

如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。

猜你在找的Shell相关文章