我需要在启动后在 Fedora 操作系统中运行程序。 我在以下位置创建服务文件: /etc/systemd/system/muxponder.service 文件看起来像这样:
[Unit]
Description=Your Program Description
[Service]
Type=simple
User=root # This will run the program as root
ExecStart=/etc/systemd/system/hello.exe
[Install]
WantedBy=multi-user.target
启用后: systemctl 启用 service_name.service
我重新启动操作系统,出现以下错误:
4 月 13 日 15:33:28 fedora (ello.exe)[741]: muxponder.service: 无法找到可执行文件 /etc/systemd/system/hello.exe: 权限被拒绝 4 月 13 日 15:33:28 fedora (ello.exe)[741]: muxponder.service: 在步骤 EXEC 生成 /etc/systemd/system/hello.exe 时失败:权限被拒绝
可执行文件存在: [root@fedora 系统]# 文件 /etc/systemd/system/hello.exe /etc/systemd/system/hello.exe:ELF 64 位 LSB 可执行文件,x86-64,版本 1 (SYSV),动态链接,解释器 /lib64/ld-linux-x86-64.so.2,BuildID[sha1 ]=d775638b8c4b716700be21202b1684bd05b6239e,对于 GNU/Linux 3.2.0,未剥离
不知道哪里出了问题,有什么建议吗?谢谢
是二进制可执行文件。 IE。当你这样做时它有x位吗
ls -l /etc/systemd/system/hello.exe
?
(将可执行文件放在该目录中是很奇怪的。
/usr/local/sbin
会更自然。在 Unix 世界中,可执行文件有任何后缀并不常见。exe
是 Windows 特定的后缀。)