You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today, I needed to quote a path that may contain spaces but I could not find the correct way to write the .service file.
I tried several things, here is the minimal setup:
# cat > /tmp/space\ bin << EOF
#!/bin/sh
echo blah > /tmp/log
EOF
# chmod +x /tmp/space\ bin
# cat > /etc/systemd/system/path-with-spaces.service << EOF
[Unit]
Description=path with spaces
After=syslog.service
[Service]
ExecStart='/tmp/space bin'
Type=oneshot
[Install]
WantedBy=multi-user.target
EOF
# systemctl daemon-reload
# systemctl status -l path-with-spaces
● path-with-spaces.service - path with spaces
Loaded: error (Reason: Invalid argument)
Active: inactive (dead)
Dec 10 09:47:45 host systemd[1]: [/etc/systemd/system/path-with-spaces.service:6] Executable path is not absolute, ignoring: '/tmp/space bin'
Dec 10 09:47:45 host systemd[1]: path-with-spaces.service lacks ExecStart setting. Refusing.
Dec 10 09:48:10 host systemd[1]: [/etc/systemd/system/path-with-spaces.service:6] Executable path is not absolute, ignoring: '/tmp/space bin'
Dec 10 09:48:10 host systemd[1]: path-with-spaces.service lacks ExecStart setting. Refusing.
With a quick search, it seems this is what is causing the error message:
Hi there,
Today, I needed to quote a path that may contain spaces but I could not find the correct way to write the .service file.
I tried several things, here is the minimal setup:
With a quick search, it seems this is what is causing the error message:
systemd/src/core/load-fragment.c
Line 635 in 564c444
And this is the the function that test for an absolute path:
systemd/src/basic/path-util.c
Line 48 in 375f1b0
So quotes are not supported for the executable path yet?
Backslash (__) does not allow to escape the space in the path too (but it is not indicated in the docs anyway).
Maybe related to #624?
On a side note, is it really necessary to try to reload the .service file even if it contain a syntax error (see pasted log above)?
Regards.
EDIT:
By the way, I'm on a Debian Jessie system (if the information is useful):
The text was updated successfully, but these errors were encountered: