Configure service startup and shutdown in Linux system 1. Run the command cd /etc/init.d to go to the folder 2. Enter the vim editing interface through the command vim tomcat 3. Use the i key to paste the following code into the editing interface The shell script is as follows #!/bin/bash # This is the init script for starting up the # Jakarta Tomcat server # # chkconfig: 345 91 10 # description: Starts and stops the Tomcat daemon. # # Source function library. . /etc/rc.d/init.d/functions # Get config. . /etc/sysconfig/network # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 0 export JAVA_HOME=/usr/local/javaweb/jdk1.8.0_192 #your own jdk installation directory tomcat_home=/usr/local/tomcat/tomcat #your own tomcat installation directory startup=$tomcat_home/bin/startup.sh shutdown=$tomcat_home/bin/shutdown.sh start(){ echo -n "Starting Tomcat service:" cd $tomcat_home $startup echo "tomcat is successfully started up" } stop(){ echo -n "Shutting down tomcat: " cd $tomcat_home $shutdown echo "tomcat is successfully shut down." } status(){ numproc=`ps -ef | grep catalina | grep -v "grep catalina" | wc -l` if [ $numproc -gt 0 ]; then echo "Tomcat is running..." else echo "Tomcat is stopped..." fi } restart(){ stop start } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status ;; restart) restart ;; *) echo $"Usage: $0 {start|stop|status|restart}" exit 1 esac (The file cannot be executed, please execute this command) Add permissions to the file so that the script file can be executed. The command is: chmod 755 /etc/rc.d/init.d/tomcat 4. Add the file to the service queue 5. Check whether the tomcat file is successfully added to the service list 6. Set the service to start automatically at boot Summary ends here The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Detailed explanation of the difference between routing hooks in Vue2.x and Vue3.x
>>: MySql index improves query speed common methods code examples
Introduction In a production environment, in orde...
Software Version Windows: Windows 10 MySQL: mysql...
1. Server environment configuration: 1. Check dis...
1. Priority of multiple servers For example, if e...
Table of contents nonsense Functions implemented ...
Preface This article mainly introduces the releva...
When the table header is fixed, it needs to be di...
I installed a Linux Ubuntu system on my computer....
Introduction to MySQL logical architecture Overvi...
This article shares the specific code for JavaScr...
Preface HTTP and HTTPS In our daily life, common ...
<br />For each of our topics, the team will ...
Configuration Preface Project construction: built...
The mini program implements a complete shopping c...
Preface In the process of continuous code deliver...