1,centos7 replaced the service command with SYSTEMCTLreference: Redhat Documentation:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/ Sect-managing_services_with_systemd-services.html#sect-managing_services_with_systemd-services-list
View all service commands:
Systemctl list-unit-files--type Service
View Services
Systemctl Status Name.service
Start the service
Systemctl Start Name.service
Stop Service
Systemctl Stop Name.service
Restart Service
Systemctl Restart Name.service increase boot start
Systemctl Enable Name.service
Remove Boot Boot
Systemctl Disable Name.service
where the. Service can be omitted.
2,tomcat increasing the startup parameters
Tomcat needs to add a PID file
Under the Tomca/bin directory, add the setenv.sh configuration, which is called when the catalina.sh is started and configures the Java memory parameters.
#add Tomcat pidcatalina_pid= "$CATALINA _base/tomcat.pid" #add java optsjava_opts= "-SERVER-XX:PERMSIZE=256M-XX: maxpermsize=1024m-xms512m-xmx1024m-xx:maxnewsize=256m "
3, Increase Tomcat.service
Add Tomcat.service to the/usr/lib/systemd/system directory and the directory must be an absolute directory.
[Unit] Description=tomcatafter=syslog.target network.target remote-fs.target Nss-lookup.target [Service]Type= forkingpidfile=/data/tomcat/tomcat.pidexecstart=/data/tomcat/bin/startup.sh execreload=/bin/kill-s HUP $ Mainpidexecstop=/bin/kill-s QUIT $MAINPIDPrivateTmp =true [install]wantedby=multi-user.target
The [unit] Configures the description of the service, which specifies that it is executed after network startup. the [service] configures the service's PID, the service starts, stops, restarts. [Install] is configured to use the user.
4, using Tomcat.service
Configure boot-up
Systemctl Enable Tomcat
Start Tomcat
Systemctl Start Tomcat
Stop Tomcat
Systemctl Stop Tomcat
Restart Tomcat
Systemctl Restart Tomcat
Because the PID is configured, the Tomcat root directory generates the Tomcat.pid file at boot time and is removed after it is stopped.
At the same time when Tomcat starts, executing start does not start two Tomcat, ensuring that only one Tomcat service is always running.
Multiple tomcat can be configured in multiple directories, with no impact.
CentOS7 increase tomcat boot, stop, configure with Systemctl