我在具有以下权限的文件夹tdk-api.service
中创建了此单元文件:/etc/systemd/system
-rwxr-xr-x
包含以下内容:
[Unit]
Description = tdk API daemon
[Service]
Type = simple
ExecStart = /usr/local/bin/start-tdk-api.sh
ExecStop = /usr/local/bin/stop-tdk-api.sh
ExecReload = /usr/local/bin/reload-tdk-api.sh
[Install]
WantedBy = multi-user.target
但我在启动时出现错误:
root@localhost:/etc/systemd/system# sudo systemctl start tdk-api
Failed to start tdk-api.service: Unknown unit: tdk-api.service
See system logs and 'systemctl status tdk-api.service' for details.
root@localhost:/etc/systemd/system# systemctl status tdk-api.service
Failed to get properties: No such interface ''
root@localhost:/etc/systemd/system#
我还尝试按照建议重新加载 systemd 守护进程
systemctl daemon-reload
我也尝试过:
root@localhost:/etc/systemd/system# systemctl enable tdk-api.service
Configuration file /etc/systemd/system/tdk-api.service is marked executable. Please remove executable permission bits. Proceeding anyway.
Created symlink /etc/systemd/system/multi-user.target.wants/tdk-api.service, pointing to /etc/systemd/system/tdk-api.service.
root@localhost:/etc/systemd/system# sudo systemctl start tdk-api
Failed to start tdk-api.service: Unknown unit: tdk-api.service
See system logs and 'systemctl status tdk-api.service' for details.
root@localhost:/etc/systemd/system# systemctl status tdk-api.service
Failed to get properties: No such interface ''