你好,我正在尝试运行 Apache tomcat 的状态,但一直失败。这是我得到的
tomcat.service - Tomcat 10 configuration file
Loaded: loaded (/etc/systemd/system/tomcat.service; enabled; preset: disabled)
Active: failed (Result: exit-code) since Thu 2023-09-07 13:02:48 EDT; 53min ago
CPU: 3ms
Sep 07 13:02:48 server1.example.com systemd[1]: Starting Tomcat 10 configuration file...
Sep 07 13:02:48 server1.example.com systemd[1263]: tomcat.service: Failed to locate executable /usr/local/tomcat10-server/bin/catalina.sh: Permission denied
Sep 07 13:02:48 server1.example.com systemd[1263]: tomcat.service: Failed at step EXEC spawning /usr/local/tomcat10-server/bin/catalina.sh: Permission denied
Sep 07 13:02:48 server1.example.com systemd[1]: tomcat.service: Control process exited, code=exited, status=203/EXEC
Sep 07 13:02:48 server1.example.com systemd[1]: tomcat.service: Failed with result 'exit-code'.
Sep 07 13:02:48 server1.example.com systemd[1]: Failed to start Tomcat 10 configuration file.
我的纳米文件/etc/systemd/system/tomcat.service
是:
[Unit]
Description=Tomcat 10 configuration file
After=syslog.target network.target
[Service]
Type=forking
User=tomcat
Group=tomcat
Environment=JAVA_HOME=/usr/lib/jvm/jre-17-openjdk
Environment='JAVA_OPTS=-Djava.awt.headless=true'
Environment=CATALINA_HOME=/usr/local/tomcat10-server
Environment=CATALINA_BASE=/usr/local/tomcat10-server
Environment=CATALINA_PID=/usr/local/tomcat10-server/temp/tomcat.pid
ExecStart=/usr/local/tomcat10-server/bin/catalina.sh start
ExecStop=/usr/local/tomcat10-server/bin/catalina.sh stop
[Install]
WantedBy=multi-user.target
我该如何修复这个问题以保证它不失败?
答案1
您的错误消息显示 catalina.sh 上的“权限被拒绝”。请验证该文件是否可执行,以及是否由tomcat
您在服务文件中指定的用户拥有。