start/stop tomcat in cpanel server

How to start/stop tomcat by using  ” /etc/init.d/tomcat” command.
Ans :
1) Check  linux server  run level by using following command
who -r
If  runlevel is 3 then create the file
vi /etc/rc.d/init.d/tomcat
and add the following code
====================================
#!/bin/sh
JAVA_HOME=/usr/local/jdk; export JAVA_HOME
TOMCAT_HOME=/usr/local/jakarta/tomcat; export TOMCAT_HOME
$TOMCAT_HOME/bin/catalina.sh $*

====================================
Save the file and then change the permission to 755
chmod 755 /etc/rc.d/init.d/tomcat
Now you can able to start/stop tomcat by using commands
To start Tomcat :
/etc/init.d/tomcat  start
To stop Tomcat :
Please use this command 2-3 times to stop the tomcat service on the server.

/etc/init.d/tomcat   stop
Done

Leave a Comment