澳门金沙国际 ,centos下tomcat自启动,centostomcat启动

 

壹 、在钦点目录创立脚本并赋予755权力

vim /etc/init.d/tomcat

#!/bin/bash
#
# kenny [email protected]
# /etc/rc.d/init.d/tomcat
# init script for tomcat precesses
#
# processname: tomcat
# description: tomcat is a j2se server
# chkconfig: 2345 86 16
# description: Start up the Tomcat servlet engine.

if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
else
echo -e "/atomcat: unable to locate functions lib. Cannot continue."
exit -1
fi

RETVAL=$?
CATALINA_HOME="/usr/local/tomcat"

case "$1" in
start)
if [ -f $CATALINA_HOME/bin/startup.sh ];
then
echo $"Starting Tomcat"
$CATALINA_HOME/bin/startup.sh
fi
;;
stop)
if [ -f $CATALINA_HOME/bin/shutdown.sh ];
then
echo $"Stopping Tomcat"
$CATALINA_HOME/bin/shutdown.sh
fi
;;
*)
echo $"Usage: $0 {start|stop}"
exit 1
;;
esac

exit $RETVAL

 

 

② 、在tomcat的安顿文件中添加相应参数

vim /usr/local/tomcat/bin/catalina.sh 

export JAVA_HOME=/usr/local/jdk1.8.0_51/
export CATALINA_HOME=/usr/local/tomcat/
export CATALINA_BASE=/usr/local/tomcat/
export CATALINA_TMPDIR=/usr/local/tomcat/temp

 

③ 、添加tomcat为系统服务并点名在个各种控制台为开机运转形式

chkconfig –add tomcat

chkconfig  tomcat on

chkconfig –list tomcat

centos下tomcat自运营。 

 

肆 、server运维验证成功,即可开机自动执行

service tomcat start

一 、在内定目录创制脚本并赋予755权力 vim /etc/init.d/tomcat #!/bin/
bash## kenny
[email protected]#
/etc/rc.d/init.d/…

 

环境:CentOS
6.3,Confluence Wiki

① 、在钦定目录创造脚本并授予755权力

壹 、在钦赐目录成立脚本并给予755权力

做完动员搬迁可平常运转,但Tomcat不可能开机运转,经过一番学学到底解决,记录如下:

vim /etc/init.d/tomcat

vim /etc/init.d/tomcat

1、修改start.sh文件

#!/bin/bash
#
# kenny kenny.zhou@tom.com
# /etc/rc.d/init.d/tomcat
# init script for tomcat precesses
#
# processname: tomcat
# description: tomcat is a j2se server
# chkconfig: 2345 86 16
# description: Start up the Tomcat servlet engine.

if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
else
echo -e "/atomcat: unable to locate functions lib. Cannot continue."
exit -1
fi

RETVAL=$?
CATALINA_HOME="/usr/local/tomcat"

case "$1" in
start)
if [ -f $CATALINA_HOME/bin/startup.sh ];
then
echo $"Starting Tomcat"
$CATALINA_HOME/bin/startup.sh
fi
;;
stop)
if [ -f $CATALINA_HOME/bin/shutdown.sh ];
then
echo $"Stopping Tomcat"
$CATALINA_HOME/bin/shutdown.sh
fi
;;
*)
echo $"Usage: $0 {start|stop}"
exit 1
;;
esac

exit $RETVAL
#!/bin/bash
#
# kenny kenny.zhou@tom.com
# /etc/rc.d/init.d/tomcat
# init script for tomcat precesses
#
# processname: tomcat
# description: tomcat is a j2se server
# chkconfig: 2345 86 16
# description: Start up the Tomcat servlet engine.

if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
else
echo -e "/atomcat: unable to locate functions lib. Cannot continue."
exit -1
fi

RETVAL=$?
CATALINA_HOME="/usr/local/tomcat"

case "$1" in
start)
if [ -f $CATALINA_HOME/bin/startup.sh ];
then
echo $"Starting Tomcat"
$CATALINA_HOME/bin/startup.sh
fi
;;
stop)
if [ -f $CATALINA_HOME/bin/shutdown.sh ];
then
echo $"Stopping Tomcat"
$CATALINA_HOME/bin/shutdown.sh
fi
;;
*)
echo $"Usage: $0 {start|stop}"
exit 1
;;
esac

exit $RETVAL

vim /home/wwwroot/tomcat_wiki/bin/startup.sh

 

 

在文书头扩展以下内容:

 

 

#!/bin/sh

② 、在tomcat的安顿文件中添加相应参数

贰 、在tomcat的布署文件中添加相应参数

# chkconfig: 2345 97 00
# description:tomcat auto start
#processname: tomcat

vim /usr/local/tomcat/bin/catalina.sh 

vim /usr/local/tomcat/bin/catalina.sh 

2、修改catalina.sh文件

export JAVA_HOME=/usr/local/jdk1.8.0_51/
export CATALINA_HOME=/usr/local/tomcat/
export CATALINA_BASE=/usr/local/tomcat/
export CATALINA_TMPDIR=/usr/local/tomcat/temp
export JAVA_HOME=/usr/local/jdk1.8.0_51/
export CATALINA_HOME=/usr/local/tomcat/
export CATALINA_BASE=/usr/local/tomcat/
export CATALINA_TMPDIR=/usr/local/tomcat/temp

vim /home/wwwroot/tomcat_wiki/bin/catalina.sh

 

 

追加以下内容:

叁 、添加tomcat为系统服务并点名在个各类控制台为开机运营情势

叁 、添加tomcat为系统服务并点名在个各类控制台为开机运转形式

export CATALINA_BASE=/home/wwwroot/tomcat_wiki
export CATALINA_HOME=/home/wwwroot/tomcat_wiki
export CATALINA_TMPDIR=/home/wwwroot/tomcat_wiki/temp
export JRE_HOME=/usr/local/jdk1.6.0_37

chkconfig –add tomcat

chkconfig –add tomcat

③ 、创建链接文件

chkconfig  tomcat on

chkconfig  tomcat on

ln –s /home/wwwroot/tomcat_wiki/bin/startup.sh /etc/init.d/tomcat

chkconfig –list tomcat

chkconfig –list tomcat

4、修改权限

 

 

chmod +x tomcat

 

 

伍 、添加运行

四 、server运转验证成功,即可开机自动执行

肆 、server运营验证成功,即可开机自动执行

chkconfig –add  tomcat(add前是三个减号)

service tomcat start

service tomcat start

chkconfig tomcat on

6、检查

service tomcat start

或者reboot

澳门金沙国际 1

相关文章