Ubuntu中让Tomcat自动启动

1.需要在/etc/init.d下面新建tomcat启动脚本

#!/bin/sh
#tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid

export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun

case $1 in
start)
sh /usr/lib/tomcat6/bin/startup.sh
;;
stop)
sh /usr/lib/tomcat6/bin/shutdown.sh
;;
restart)
sh /usr/lib/tomcat6/bin/shutdown.sh
sh /usr/lib/tomcat6/bin/startup.sh
;;
*)
echo 'Usage:tomcat start|stop|restart'
;;
esac

exit 0


2.这样还不能自动启动,需要添加到系统服务里面
使用

sysv-rc-conf tomcat on

也可以使用

update-rc.d tomcat6 defaults
update-rc.d tomcat6 remove


3如果提示找不到sysv-rc-conf
则需要安装

apt-get install sysv-rc-conf


4.如果本地设置没有设置好,Per会给出下面的错误提示:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "zh_CN.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory


我们只需要执行以下命令就OK了

root@idealserver:~# apt-get install locales
root@idealserver:~# dpkg-reconfigure locales
root@idealserver:~# locale

5.reboot一下查看我们的tomcat是否已经启动.

你可能感兴趣的:(Linux,Tomcat,Ubuntu,Java,Perl,JVM)