jetty8新環境佈署指令碼
阿新 • • 發佈:2019-02-03
while getopts ":n:o:t:" opt do case $opt in n) projectName=$OPTARG ;; o) projectOrder=$OPTARG ;; t) projectType=$OPTARG ;; ?) echo "未知引數" exit 1;; esac done if test "$projectName" == "Test" || test "$projectOrder" == "0" then echo "$projectName $projectOrder 未知引數" exit 1 fi newProjectName=/opt/jetty$projectName cp -rf /opt/jetty1 $newProjectName case $projectType in ops) mv $newProjectName/contexts/web1.xml $newProjectName/contexts/web${projectOrder}.xml mv $newProjectName/webapps/web1 $newProjectName/webapps/web$projectOrder contextConfig=$newProjectName/contexts/web${projectOrder}.xml sed -i "s/web1/web${projectOrder}/g" $contextConfig ;; sh) rm -rf $newProjectName/contexts/* rm -rf $newProjectName/webapps/web1 ;; ?) echo "未知引數" exit 1;; esac jettyConfig=$newProjectName/etc/jetty.xml port=$((projectOrder+8011)) cat_port_line() { cat $jettyConfig | egrep -n "^ {0,}8011{1,}" | awk '{print $2}' } portLine=`cat_port_line` sed -i "s/8011/${port}/g" $jettyConfig