I have installed the tomcat v8.5.23 as client on my ubuntu14.04 machine.Now I want to run it as a service.Please tell me how to run tomcat8 as service from the tomcat8 client.
Asked
Active
Viewed 1,588 times
1
-
You can find many articles explaining this by doing a simple google search. Here is an example using `upstart`: https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-ubuntu-14-04 – SebaGra Jul 23 '20 at 13:59
1 Answers
-1
To run tomcat as a service first create a init file as following steps: create init script in /etc/init.d/tomcat8 folder as: To run tomcat as a service first create a init file as following steps: create init script in /etc/init.d/tomcat8 folder as:
#!/bin/bash
### BEGIN INIT INFO
# Provides: tomcat7
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/Stop Tomcat server
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
start() {
sh /var/opt/tomcat8/bin/startup.sh
}
stop() {
sh /var/opt/tomcat8/bin/shutdown.sh
}
case $1 in
start|stop) $1;;
restart) stop; start;;
*) echo "Run as $0 "; exit 1;;
Esac
and then save it and give 777 permission to this file. after that you can start the tomcat with start/stop/restart command as: /etc/init.d/tomcat8 start

poojagupta
- 1
- 1