Centos 7 设置开机自启tomcat

#第一步首先要提早安装好tomcat 而后在/usr/lib/systemd/system目录下添加tomcat8.service 命令以下:
vi /usr/lib/systemd/system/tomcat8.servicetomcat

#第二步在里面输入:
[Unit]
Description=Tomcat8
After=syslog.target network.target remote-fs.target nss-lookup.targetide

[Service]
Type=forking
Environment='JAVA_HOME=/data/server/jdk1.8'
Environment='CATALINA_PID=/data/server/tomcat8/bin/tomcat.pid'
Environment='CATALINA_HOME=/data/server/tomcat8/'
Environment='CATALINA_BASE=/data/server/tomcat8/'
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'server

WorkingDirectory=/data/server/tomcat8/ip

ExecStart=/data/server/tomcat8/bin/startup.sh
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=truerem

[Install]
WantedBy=multi-user.targetget

#第三步来配置tomcat 开机启动输入:
systemctl enable tomcat8it

#第四步开始启动tomcat8服务输入:
systemctl start tomcat8io

#最后重启输入:
rebootclass

#查看有没有tomcat服务
ps aux | grep tomcatjdk

相关文章
相关标签/搜索