Logo
Explore Help
Sign In
dasharo/systemd
0
0
Fork 0
You've already forked systemd
mirror of https://github.com/Dasharo/systemd.git synced 2026-03-06 15:02:31 -08:00
Code Issues Packages Projects Releases Wiki Activity
Files
b8cb5effeb084f160b2f668d83501462b1439343
systemd/test/test-execute/exec-basic.service

14 lines
285 B
SYSTEMD
Raw Normal View History

systemd: do not require absolute paths in ExecStart Absolute paths make everything simple and quick, but sometimes this requirement can be annoying. A good example is calling 'test', which will be located in /usr/bin/ or /bin depending on the distro. The need the provide the full path makes it harder a portable unit file in such cases. This patch uses a fixed search path (DEFAULT_PATH which was already used as the default value of $PATH), and if a non-absolute file name is found, it is immediately resolved to a full path using this search path when the unit is loaded. After that, everything behaves as if an absolute path was specified. In particular, the executable must exist when the unit is loaded.
2018-03-25 20:50:15 +02:00
[Unit]
Description=Test for basic execution
[Service]
ExecStart=touch /tmp/a ; /bin/touch /tmp/b ; touch /tmp/c
ExecStart=test -f /tmp/a
ExecStart=!test -f /tmp/b
ExecStart=!!test -f /tmp/c
ExecStart=+test -f /tmp/c
ExecStartPost=rm /tmp/a /tmp/b /tmp/c
PrivateTmp=true
Type=oneshot
Reference in New Issue Copy Permalink
Powered by Gitea Page: 355ms Template: 11ms
English
English
Licenses API