简体   繁体   English

为什么即使文件存在,rhel8 aws systemd 服务也会抛出 No such file or directory 错误?

[英]Why is rhel8 aws systemd service throws No such file or directory error even when file exists?

I have a systemd service define on rhel8我在 rhel8 上有一个 systemd 服务定义

[Unit]
Description=Apache Kafka - ZooKeeper
Documentation=http://docs.confluent.io/
After=network.target

[Service]
Type=simple
EnvironmentFile=/app/bin/confluent/etc/kafka/zookenv.properties
User=kafka
Group=kafka
ExecStart=/app/bin/confluent/bin/zookeeper-server-start /app/bin/confluent/etc/kafka/zookeeper.properties
TimeoutStopSec=180
Restart=no

[Install]
WantedBy=multi-user.target

when i start this service i get the below error in journalctl当我启动此服务时,我在 journalctl 中收到以下错误

Jul 09 12:00:51 10.204.142.111 systemd[1]: confluent-zookeeper.service: Failed to load environment files: No such file or directory
Jul 09 12:00:51 10.204.142.111 systemd[1]: confluent-zookeeper.service: Failed to run 'start' task: No such file or directory
Jul 09 12:00:51 10.204.142.111 systemd[1]: confluent-zookeeper.service: Failed with result 'resources'.

the environment file exists in the path and so does the start script and properties files.环境文件存在于路径中,启动脚本和属性文件也存在。

this is on RHEL8 aws and trying this for the first time.这是在 RHEL8 aws 上,这是第一次尝试。

the component starts up fine when i run the start script manually from command line.当我从命令行手动运行启动脚本时,组件启动正常。

Check that the path and file for检查路径和文件

EnvironmentFile=/app/bin/confluent/etc/kafka/zookenv.properties

are correct是正确的

In my case, I had my service file like this就我而言,我的服务文件是这样的

ExecStart=/app/bin/confluent/bin/zookeeper-server-start
EnvironmentFile=/app/bin/confluent/etc/kafka/zookenv.properties

I changed it to我把它改成

EnvironmentFile=/app/bin/confluent/etc/kafka/zookenv.properties
ExecStart=/app/bin/confluent/bin/zookeeper-server-start

Then I run,然后我跑,

systemctl daemon-reload &&
systemctl restart service-name.service`

Initially, I was using `systemctl start service-name.service` and I guess that didn't make systemd read the environment files properly

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM