#the script is how to install the jetty
echo $1 $2 $3
if [ $1 = "" ] || [ $2 = "" ] || [ $3 = "" ];then
echo "error:Input the correct variables"
exit
else
echo "OK!"
if [ -f jetty-distribution-8.0.4.v20111024.tar.gz ];then
echo "The packages is Ok!"
else
wget http://download.eclipse.org/jetty/8.0.4.v20111024/dist/jetty-distribution-8.0.4.v20111024.tar.gz
if [ "$?" == "0" ];then
echo "###################DOWNLOAD NOW!#################"
sleep 5
else
echo "###################Problem from download!###############"
exit 0
fi
fi
if [ -d jetty-distribution-8.0.4.v20111024 ];then
echo "The dir exists!"
else
tar zxvf jetty-distribution-8.0.4.v20111024.tar.gz
fi
mv jetty-distribution-8.0.4.v20111024 $1
mkdir $1/run/
cd $1/etc/
sed -i '/port/ s/8080/'$2'/' jetty.xml
cd /home/report/$1/bin
sed -i '82s/^/JETTY_HOME=\/home\/report\/'$1'\n/' jetty.sh
sed -i '83s/^/JETTY_RUN=\/home\/report\/'$1'\/run\n/' jetty.sh
cd /home/report/$1/contexts/
sed -i '/webapps/ s/test/'$3'/' test.xml
sed -i '31d' test.xml
mv test.xml $3.xml
cd
echo -e "\nThe jetty installation complete!\n"
echo -e "Good luck!\n"
fi
注意,$1爲jetty的名字,$2爲jetty啓動的端口,$3根據實際情況去修改.執行腳本前安裝好java環境,安裝路徑也要根據實際情況去修改。
./jettyinstall.sh $1 $2 $3