可以这么说,我正在尝试创建“ Hello World”服务。称为autologger.service
,存储在/usr/lib/systemd/system/autologger.service
。
我尝试过sudo service autologger start
,但systemctl
返回了标准:
Job for autologger.service failed. See 'systemctl status
autologger.service' and 'journalctl -xn' for details.
当我检查时/var/log/messages
,看到以下错误消息:
Failed at step EXEC spawning /opt/autologger/placeholder.sh: Permission denied
我的问题是:如何授予任何服务权限?
这是服务单元文件:
[Unit]
Description=Hello World
DefaultDependencies=no
Before=shutdown.target reboot.target halt.target
[Service]
Type=oneshot
ExecStart=/opt/autologger/placeholder.sh
placeholder.sh仅包含
#!/bin/bash
echo "Hello World"