加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

给setenv.sh增加-XX:+UseCompressedOops

发布时间:2020-12-15 07:09:50 所属栏目:安全 来源:网络整理
导读:今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 #!/bin/bash#Program:# 在每个tomcat下的bin里创建setenv.sh#1.输入目录read -p "请输入shequ的目录:" dirif [ ${dir} == "" -o ! -d ${dir} ]; then

以下代码由PHP站长网 52php.cn收集自互联网

现在PHP站长网小编把它分享给大家,仅供参考

#!/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 

以上内容由PHP站长网【52php.cn】收集整理供大家参考研究

如果以上内容对您有帮助,欢迎收藏、点赞、推荐、分享。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读