我创建了一个 systemd 服务文件(专门用于 svnserve;我实际上使用的是这里的示例 https://stackoverflow.com/a/40584047/464087 ),当我启用它时,输入
sudo systemctl enable svnserve
我得到回应
Failed to execute operation: Invalid argument
运行
sudo systemctl status svnserve
产量
● svnserve.service - Subversion protocol daemon
Loaded: loaded (/etc/systemd/system/svnserve.service; enabled; vendor preset: enabled)
Active: inactive (dead)
没有给我任何关于任何错误的线索。然后我可以在没有任何错误的情况下启动该服务,并且它似乎按预期运行,并且在启动 systemctl status 之后,我仍然不知道有什么问题:
● svnserve.service - Subversion protocol daemon
Loaded: loaded (/etc/systemd/system/svnserve.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2018-01-09 22:10:14 UTC; 6s ago
Process: 9677 ExecStart=/usr/bin/svnserve $DAEMON_ARGS (code=exited, status=0/SUCCESS)
Main PID: 9678 (svnserve)
Tasks: 1
Memory: 964.0K
CPU: 2ms
CGroup: /system.slice/svnserve.service
└─9678 /usr/bin/svnserve --daemon --pid-file /run/svnserve/svnserve.pid --root /srv/svn/repos --log-file /var/log/svnserve/svnserve.log
那么这个错误信息是什么意思呢? “无效论点”应该适用于哪一层? svnserve 命令的参数?服务文件中的某些属性? servicectl 命令本身的命令行参数?
FWIW 这是在 Ubuntu 16.04 LTS 服务器上。
最佳答案
如果您将文件从具有一种编码的系统(例如 Windows)复制/粘贴到另一种编码(例如 linux),则文件编码可能存在问题,或者字符的解释不同。您可以转换文件并重新分析以查看它是否被正确解释。
$ sudo systemd-analyze verify yourname.service
/etc/systemd/system/yourname.service:1: Assignment outside of section. Ignoring.
$ vim +"set nobomb | set fenc=utf8 | x" yourname.service
^[[200~
这样的字符$ sudo systemctl enable yourname.service
关于systemd - 运行systemctl enable时 "Failed to execute operation: Invalid argument"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48177558/