systemctl服务部署错误:code=exited, status=217/USER

在centos8下给tomcat注册systemctl服务时报错:

Process: 2688 ExecStart=/usr/local/tomcat/apache-tomcat-9.0.36/bin/startup.sh (code=exited, status=217/USER)

systemctl服务部署错误:code=exited, status=217/USER_第1张图片

 我的配置文件

[Unit]
Description=Tomcat9 servlet
After=syslog.target network.target

[Service]
Type=forking

User=tomcat
Group=tomcat

Environment="JAVA_HOME=/usr/lib/jvm/jre"
Environment="JAVA_OPTS=-Djava.awt.headless=true"

Environment="CATALINA_BASE=/usr/local/tomcat/apache-tomcat-9.0.36"
Environment="CATALINA_HOME=/usr/local/tomcat/apache-tomcat-9.0.36"
Environment="CATALINA_PID=/usr/local/tomcat/apache-tomcat-9.0.36/temp/tomcat.pid"
Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"

ExecStart=/usr/local/tomcat/apache-tomcat-9.0.36/bin/startup.sh
ExecStop=/usr/local/tomcat/apache-tomcat-9.0.36/bin/shutdown.sh

[Install]
WantedBy=multi-user.target

最后查到是因为[Service]下的User和Group错了,没有这个用户和组,全部改成root就好了。

[Unit]
Description=Tomcat9 servlet
After=syslog.target network.target

[Service]
Type=forking

User=root
Group=root

Environment="JAVA_HOME=/usr/lib/jvm/jre"
Environment="JAVA_OPTS=-Djava.awt.headless=true"

Environment="CATALINA_BASE=/usr/local/tomcat/apache-tomcat-9.0.36"
Environment="CATALINA_HOME=/usr/local/tomcat/apache-tomcat-9.0.36"
Environment="CATALINA_PID=/usr/local/tomcat/apache-tomcat-9.0.36/temp/tomcat.pid"
Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"

ExecStart=/usr/local/tomcat/apache-tomcat-9.0.36/bin/startup.sh
ExecStop=/usr/local/tomcat/apache-tomcat-9.0.36/bin/shutdown.sh

[Install]
WantedBy=multi-user.target

 

你可能感兴趣的:(Z-Linux,systemctl服务部署错误,code=exited,status=217/USER,tomcat.service)