TomcatControl. sh part :#! /Bin/sh # Tomcat automatic start in Ubuntu #1: first install the auto-start management tool # apt-getinstallsysv-rc-conf #2: append the Tomcat STARTUP script # create the tomcatControl script file, and put it in/etc/init. d/down, # note that the File Permission is set to 755.
TomcatControl. sh part:
#! /Bin/sh
# Tomcat Automatic startup in Ubuntu
#1: first install the self-start management tool
# Apt-get install sysv-rc-conf
#2: append the Tomcat Startup Script
# Create a tomcatControl script file and place it under/etc/init. d,
# Note that the File Permission is set to 755. The script content is as follows:
Export JAVA_HOME =/usr/local/Easiware/jdk1.5.0 _ 09
Case $1 in
Startup)
Sh/opt/apache-tomcat-5.5.20/bin/startup. sh
;;
Shutdown)
Sh/opt/apache-tomcat-5.5.20/bin/shutdown. sh
Break
;;
Restart)
Sh/opt/apache-tomcat-5.5.20/bin/shutdown. sh
Sh/opt/apache-tomcat-5.5.20/bin/startup. sh
;;
*)
Sh/opt/apache-tomcat-5.5.20/bin/startup. sh
;;
Esac
Exit 0
#3: run the self-starting command
# Sysv-rc-conf tomcatControl on
# Disable auto start:
# Sysv-rc-conf tomcatControl off
#4: restart: reboot
Note:[Linux community http://www.linuxidc.com]
1. You can also use the following command to add Automatic startup:
Update-rc.d tomcat installation directory defaults
2) update-rc.d tomcat installation directory remove
2. If you cannot find sysv-rc-conf
Apt-get install sysv-rc-conf
3. If the local settings are not set properly, the following error message is displayed for Per:
1. perl: warning: Setting locale failed.
2. perl: warning: Please check that your locale settings:
3. LANGUAGE = (unset ),
4. LC_ALL = (unset ),
5. LANG = "zh_CN.UTF-8"
6. are supported and installed on your system.
7. perl: warning: Falling back to the standard locale ("C ").
8. locale: Cannot set LC_CTYPE to default locale: No such file or directory
9. locale: Cannot set LC_MESSAGES to default locale: No such file or directory
10. locale: Cannot set LC_ALL to default locale: No such file or directory
Solution:
We only need to execute the following command to make it OK.
1. root @ idealserver :~ # Apt-get install locales
2. root @ idealserver :~ # Dpkg-reconfigure locales
3. root @ idealserver :~ # Locale
# In fact, there is a very simple method to start automatically at startup:
Run the tomcat startup script command in this example:/opt/apache-tomcat-5.5.20/bin/startup. sh.
Put it in the/etc/rc. local file. Note that the Command Script must be placed before exit 0.