└─2219 /usr/bin/java .file=/home/yky/my-tomcat/apache-tomcat-8.5.61.ġ May 27, 21:14:21 localhost.localdomain systemd: Starting my-tomcat.ġ May 27, 21:14:21 localhost.localdomain startup.sh: Tomcat started.ġ May 27, 21:14:21 localhost.localdomain systemd: Started my-tomcat.Ĭheck whether to start by command # Find whether the service exists according to the port number Process: 2205 ExecStart=/home/yky/my-tomcat/apache-tomcat-8.5.61/bin/startup.sh (code=exited, status=0/SUCCESS) Loaded: loaded (/usr/lib/systemd/system/rvice disabled vendor preset: disabled)Īctive: active (running) since III 21:14:21 CST 10s ago # Viewing service status through systemctl
Registration services # Refresh service after adding / modifying service file # Cannot be used to stop execstop = / home / yky / my Tomcat / apache-tomcat-8.5.61/bin/ shutdown.sh PIDFile=/home/yky/my-tomcat/apache-tomcat-8.5.61/bin/tomcat.pidĮxecStart=/home/yky/my-tomcat/apache-tomcat-8.5.61/bin/startup.sh systemd will start starting the successor unit immediately after the parent process exits. # It is suggested to set PIDFile = option at the same time to help systemd locate the main process of the service accurately and reliably. # That is, when all communication channels have been built and started successfully, the parent process will exit and the child process will continue to run as the main service process. # If it is set to forking, it means that ExecStart = process will use fork() system call during startup. It must be set to one of simple, exec, forcing, oneshot, DBUS, notify and idle # For example, after= syslog.target network.target rvice # After that service is started, multiple services can be set up # Switch to the service directory (centos service)
Start writing service # Switch to the service directory (the service of deepin) The pid file appears under the bin directory, indicating that the setting is successful. 1 root root 5 1 June 27, 20:16 bin/tomcat.pid Tomcat apache-tomcat-8.5.61]# ll bin/*pid Using CATALINA_PID: /home/yky/my-tomcat/apache-tomcat-8.5.61/bin/tomcat.pid Using CLASSPATH: /home/yky/my-tomcat/apache-tomcat-8.5.61/bin/bootstrap.jar:/home/yky/my-tomcat/apache-tomcat-8.5.61/bin/tomcat-juli.jar Using CATALINA_TMPDIR: /home/yky/my-tomcat/apache-tomcat-8.5.61/temp Using CATALINA_HOME: /home/yky/my-tomcat/apache-tomcat-8.5.61 Using CATALINA_BASE: /home/yky/my-tomcat/apache-tomcat-8.5.61 # Enter the start command and the using catalog will appear_ PID description set apache-tomcat-8.5.61]#. # Only set CATALINA_HOME if not already setĬatalina appears_ PID=$PRGDIR/ tomcat.pid Description modified successfully Verify that pid is on apache-tomcat-8.5.61]# pwd $var _must_ be set to either true or false.
# See the License for the specific language governing permissions and # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # distributed under the License is distributed on an "AS IS" BASIS,
# Unless required by applicable law or agreed to in writing, software # (the "License") you may not use this file except in compliance with # The ASF licenses this file to You under the Apache License, Version 2.0
# this work for additional information regarding copyright ownership. # Licensed to the Apache Software Foundation (ASF) under one or more Then use the cat command to modify as follows: cat bin]# cat catalina.sh Modification catalina.sh File, add the CATALINAPID parameter line in the line below PRGDIR, as follows: PRGDIR=dirname "$PRG" # Here, considering that it will eventually become a service for execution, 755 permissions are granted The user of the file and other group users do not have execute permissions! # 777 is that all users have execute, read and write permissions, 755 is that root can execute permissions. # Generally, a simple authorization is 755 or 777
Then put it in your target directory through xftp Unzip tomcat and edit it # Because my tomcat is zip compressed, the next unzip decompression software first
Next, I'll take tomcat as an example Download tomcatĭownload tomcat-8.5.61 from apack website: In order to better manage their own small programs, you can directly register some of their own small tools as linux services.