【发布时间】:2015-10-24 11:56:01
【问题描述】:
我正在获得我创建的一个简单的 systemd 服务以正确启动。
这里是tomcat.service,我已经放入/lib/systemd/system:
[Unit]
Description=A systemd daemon configured to run Apache Tomcat 8.
After=syslog.target network.target
[Service]
Type=forking
PIDFile=/home/technomage/Migration/Programming\ Files/Development\ Plugins\ and\ Software/apache-tomcat-8.0.26/bin/tomcat.pid
ExecStart=/home/technomage/Migration/Programming\ Files/Development\ Plugins\ and\ Software/apache-tomcat-8.0.26/bin/startup.sh
ExecStop=/home/technomage/Migration/Programming\ Files/Development\ Plugins\ and\ Software/apache-tomcat-8.0.26/bin/shutdown.sh
[Install]
WantedBy=multi-user.target
将文件放入文件夹后,我已经运行systemctl enable tomcat.service。
在此之后,运行 sudo systemctl start tomcat.service 会出现以下错误:
Job for tomcat.service failed. See 'systemctl status tomcat.service' and 'journalctl -xn' for details.
通过sudo journalctl 仔细检查有问题的错误会发现以下相关错误:
Oct 24 19:22:05 theforge systemd[6674]: Failed at step EXEC spawning /home/technomage/Migration/Programming\ Files/Development\ Plugins\ and\ Software/apache-tomcat-8.0.26/bin/startup.sh: No such file or directory
Oct 24 19:22:05 theforge systemd[1]: tomcat.service: control process exited, code=exited status=203
但是,我知道给ExecStart 的位置是存在的,因为我可以将这个花絮粘贴到我的shell 中,它会完美地启动Tomcat!
所以我有点困惑。我试图从路径中删除\s,认为它可能利用了一些奇怪的受 Windows 影响的风格。仍然没有任何效果。
我哪里搞砸了?
【问题讨论】:
-
...搞砸了?当时您决定在文件夹名称中使用空格 ;-)
-
@Marged So..
systemd没有正确处理空格的能力?这似乎.. 很不一样.. 考虑到有多少发行版全心全意地采用它。 -
除了检查所有涉及删除空格的文件夹的权限之外,这是我第一次尝试解决这个问题