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
React tsx generates a random verification code fo...
1. Create a user: Order: CREATE USER 'usernam...
1. Function: xargs can convert the data separated...
Table of contents Preface Reference Comparison Ma...
MySQL (5.6 and below) parses json #json parsing f...
1. Introduction It has been supported since versi...
JavaScript scripts can be embedded anywhere in HT...
Table of contents 1. Install Docker 2. Write code...
The command line mysqld –skip-grant-tables cannot...
When using setinterval, it is found that it will ...
1. Download, install and configure mysql-8.0.15 1...
Preface Tip: Here you can add the approximate con...
Table of contents 1. Custom instructions 1. Regis...
First of all, let me talk to you about my daily l...
We implement a red image style for the clicked bu...