How to Start apache tomcat server on startup in Centos,Redhat
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
#!/bin/bash
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
JAVA_HOME=jdk path
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=apache path
case $1 in
start)
sh $CATALINA_HOME/bin/startup.sh
;;
stop)
sh $CATALINA_HOME/bin/shutdown.sh
;;
restart)
sh $CATALINA_HOME/bin/shutdown.sh
sh $CATALINA_HOME/bin/startup.sh
;;
esac
exit 0
4. Save the file.
5. Set permission to created file.
# chmod 755 tomcat
6. Add on startup
# chkconfig --add tomcat
# chkconfig --level 35 tomcat on
7. Start tomcat service.
# /etc/init.d/tomcat on
8. Similarly stop and restart tomcat service.