Showing posts with label Start apache tomcat server on startup in Centos. Show all posts
Showing posts with label Start apache tomcat server on startup in Centos. Show all posts

Tuesday 20 September 2016

How to Start apache tomcat server on startup in Ubuntu,LinuxMint

1. First install the apache server.


                           http://rapidsolutions4u.blogspot.in/2016/09/install-apache-tomcat-on-linux-1.html

2. Go to init.d directory.


                                # cd /etc/init.d


3. Create and edit "tomcat.sh" file.


                                # vim tomcat.sh


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

    export JAVA_HOME=jdk path


    case $1 in

    start)
            sh /home/apache-tomcat-8.5.4/bin/startup.sh
            ;;
    stop)
            sh /home/apache-tomcat-8.5.4/bin/shutdown.sh
            ;;
    restart)
            sh /home/apache-tomcat-8.5.4/bin/shutdown.sh
            sh /home/apache-tomcat-8.5.4/bin/startup.sh
            ;;
    esac
    exit 0


4. Save the file.

5. Set permission to created file.

                               # sudo chmod 755 /etc/init.d/tomcat

6. Create links


                               # sudo ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
                              # sudo ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat


7. Restart tomcat service.



                             # /etc/init.d/tomcat restart



8. Similarly stop and restart tomcat service.