无法使用 systemd 启动 wildfly

无法使用 systemd 启动 wildfly

Centos 7

Wildfly-16.0.0.Beta1

JDK 1.8.0_212

我无法使用“systemctl start wildfly”启动 wildfly,但我可以使用“/opt/wildfly/bin/launch.sh standalone standalone.xml 192.168.56.200 &”启动它

Config file:
# cat /etc/wildfly/wildfly.conf
# The configuration you want to run
WILDFLY_CONFIG=standalone.xml

# The mode you want to run
WILDFLY_MODE=standalone

# The address to bind to
WILDFLY_BIND=192.168.56.200

Systemctl 状态

[root@liferay ~]# systemctl status wildfly -l
● wildfly.service - The WildFly Application Server
   Loaded: loaded (/etc/systemd/system/wildfly.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2019-04-22 17:42:47 +08; 14min ago
  Process: 12925 ExecStart=/opt/wildfly/bin/launch.sh $WILDFLY_MODE $WILDFLY_CONFIG $WILDFLY_BIND (code=exited, status=1/FAILURE)
 Main PID: 12925 (code=exited, status=1/FAILURE)

Apr 22 17:42:46 liferay systemd[1]: Started The WildFly Application Server.
Apr 22 17:42:47 liferay systemd[1]: wildfly.service: main process exited, code=exited, status=1/FAILURE
Apr 22 17:42:47 liferay systemd[1]: Unit wildfly.service entered failed state.
Apr 22 17:42:47 liferay systemd[1]: wildfly.service failed.

系统单元

# cat /etc/systemd/system/wildfly.service
[Unit]
Description=The WildFly Application Server
After=syslog.target network.target
Before=httpd.service

[Service]
Environment=LAUNCH_JBOSS_IN_BACKGROUND=1
EnvironmentFile=-/etc/wildfly/wildfly.conf
User=wildfly
LimitNOFILE=102642
PIDFile=/var/run/wildfly/wildfly.pid
ExecStart=/opt/wildfly/bin/launch.sh $WILDFLY_MODE $WILDFLY_CONFIG  $WILDFLY_BIND
StandardOutput=null

[Install]
WantedBy=multi-user.target

我怎样才能让它与 systemd 一起工作?

答案1

检查提供的 systemd 单元后,我发现有一个 PID 文件夹设置

mkdir /var/run/wildfly/
chown wildfly. /var/run/wildfly/

这些命令修复了这个问题。

相关内容