Chinaunix首页 | 论坛 | 博客
  • 博客访问: 10707804
  • 博文数量: 2905
  • 博客积分: 20098
  • 博客等级: 上将
  • 技术积分: 36298
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-23 05:00
文章存档

2012年(1)

2011年(3)

2009年(2901)

分类: LINUX

2009-03-23 11:34:36

这几天真是累。常常下半夜3点睡觉。是因为这段时间对LINUX下的SHELL编程喜欢上了。

一时弄的忘了睡觉。还好,累没白累。遍写了一个JDK+TOMCAT的自动安装,配置的脚本

在这里我把配置出来的成果拿来和大家分享一下。希望有高手来指定一下,我在编程中的不足之处。

我将十分的感谢~~!

首先touch service.sh

chmod a+x service.sh

 


 #!/bin/bash
#this is jdk+tomcat of server allocation

touch /home/aaaaa

  jk="/home/aaaaa"

        echo "#!/bin/bash


                    service vsftpd stop

    " >$jk

chmod a+x $jk

cd /home

./aaaaa
rm -rf /home/aaaaa

echo "select 'N' is withdraws from ;
        select 'Y' Will be able to carry out JDK + TOMCAT server allocation .
if select 'Y' You need to wait for several minutes ,
If you do not want to wait to invite note CTRL + C, the key withdraws from"

    echo -n "select Y or N:"


read NAME

     if [ "$NAME" == "N" ]


then

         echo "select 'N' is exit"

else

     find / -name jakarta-tomcat-5.0.28.tar.gz > /aaa


                         tar -zxvf `cat /aaa`

mkdir /opt/tomcat

find / -name jakarta-tomcat-5.0.28 > /la


     echo "Torture fatigued jakarta-tomcat-5.0.28/ in course of waiting for one meeting to opt/tomcat/, please"


cp -r `cat /la`/* /opt/tomcat


     find / -name j2sdk-1.4.2-03-linux-i586.bin > /aaa


   chmod a+x `cat /aaa`

              cp `cat /aaa` /
cd /

./j2sdk-1.4.2-03-linux-i586.bin

rm -rf /aaa
     mkdir /usr/jdk

cp -r /j2sdk1.4.2/* /usr/jdk

rm -rf /j2sdk1.4.2 /j2sdk-1.4.2-03-linux-i586.bin

  mv /etc/profile /etc/zuan

sed 's/export/& JAVA_HOME CLASS_PASS TOMCAT_HOME /' /etc/zuan>/etc/yirehe

               sed '/local/a pathmunge /usr/jdk/bin' /etc/yirehe>/etc/ewang

sed '/LOGNAME=$USER/a\CLASS_PATH="/usr/jdk/lib/tools.jar" JAVA_HOME="/usr/jdk/" TOMCAT_HOME="/opt/tomcat/"' /etc/ewang>/etc/profile

rm -rf /etc/zuan /etc/yirehe /etc/ewang

mv /opt/tomcat/conf/tomcat-users.xml /opt/tomcat/conf/bdyd

sed '7d' /opt/tomcat/conf/bdyd>/opt/tomcat/conf/yileng

sed '9d' /opt/tomcat/conf/yileng>/opt/tomcat/conf/bdyda

echo "" >> /opt/tomcat/conf/bdyda

echo "" >> /opt/tomcat/conf/bdyda

sed 's/aaa/"admin"/g' /opt/tomcat/conf/bdyda> /opt/tomcat/conf/kaka

sed 's/yirehe/"admin,manager"/g' /opt/tomcat/conf/kaka> /opt/tomcat/conf/tomcat-users.xml

rm -rf /opt/tomcat/conf/bdyd /opt/tomcat/conf/yileng /opt/tomcat/conf/bdyda /opt/tomcat/conf/kaka


mv /opt/tomcat/conf/server.xml /opt/tomcat/conf/aaa

sed 's/Connector port="8080"/Connector port="80"/' /opt/tomcat/conf/aaa>/opt/tomcat/conf/djdk

sed 's/Connector port="8443"/Connector port="443"/' /opt/tomcat/conf/djdk>/opt/tomcat/conf/server.xml

rm -rf /opt/tomcat/conf/djdk /opt/tomcat/conf/aaa

mv /opt/tomcat/conf/server.xml /opt/tomcat/conf/aaa

sed 's/Connector port="8080"/Connector port="80"/' /opt/tomcat/conf/aaa>/opt/tomcat/conf/djdk

sed 's/Connector port="8443"/Connector port="443"/' /opt/tomcat/conf/djdk>/opt/tomcat/conf/server.xml

rm -rf /opt/tomcat/conf/djdk /opt/tomcat/conf/aaa

mv /opt/tomcat/bin/startup.sh /opt/tomcat/bin/aaa
touch /opt/tomcat/bin/startup.sh
chmod a+x /opt/tomcat/bin/startup.sh
aa="/opt/tomcat/bin/startup.sh"
echo "export JAVA_HOME=/usr/jdk
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
export PATH=$PATH:$JAVA_HOME/bin
export CATALINA_HOME=/opt/tomcat
/opt/tomcat/bin/catalina.sh start
" >$aa
echo "/opt/tomcat/bin/startup.sh" >> /etc/rc.d/rc.local

chkconfig --level 3 httpd off

source /etc/profile

/opt/tomcat/bin/startup.sh

touch /hello.java

echo "public class HelloWorld{
public static void main(String args[]){
System.out.println("nihao");

}
}

" > /hello.java

sed 's/nihao/"Hello, World"/g' /hello.java >/HelloWorld.java

rm -rf hello.java

touch /mmm.sh

echo "#!/bin/bash
#This is the script testing JAVA
javac /HelloWorld.java
java HelloWorld

if
   HelloWorld="Haha"

then

echo "Successful"

else

echo "Fail"

fi

" > /mmm.sh


sed 's/Haha/"Hello, Wrold"/g' /mmm.sh>/kkk.sh
sed 's/Successful/"Successful"/g' /kkk.sh>/nnn.sh
sed 's/Fail/"Fail"/g' /mmm.sh>/hello.sh

rm -rf /mmm.sh /kkk.sh /nnn.sh
chmod a+x /hello.sh


fi


echo "Jdk + tomcat installation and allocation have been completed.

                      You can work also no to come to test an once IP being able    to import a server on IE.

Hanging coming to test once JAVA your hello.sh

                                     under being able to run root builds"


再次希望朋友们提出宝贵的意见。为了你我的提高。一直努力着。

本文出自 “E网咖啡猫” 博客,转载请与作者联系!

阅读(1675) | 评论(0) | 转发(0) |
0

上一篇:LINUX 初学者资料

下一篇:JDK+TOMCAT在LINUX下简单的配置

给主人留下些什么吧!~~