Logo
Explore Help
Sign In
morgan/systemd
1
0
Fork 0
You've already forked systemd
mirror of https://github.com/morgan9e/systemd synced 2026-04-16 01:16:10 +09:00
Code Issues Packages Projects Releases Wiki Activity
Files
f20db199541ea35c65edfeed9e5401cab6fe6bac
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 Version: 1.25.5 Page: 395ms Template: 2ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API