[systemd-devel] macros in systemd unit files question
gmane at colin.guthr.ie
Wed Jul 31 06:36:25 PDT 2013
'Twas brillig, and lux-integ at 31/07/13 13:14 did gyre and gimble:
> I am trying to learn systemD. I scaned through some of the man pages.
The first thing to learn is that's it's systemd, not systemD ;)
> I am
> here asking if systemD unit file synthesis can be made to support macros;
> for example of the following type:-
> IF mountpoint exists
> /bin/mount /dev/something $mountpoint
> /bin/mount /dev/something somewherelse
As Tom already said, the units are declarative, so if/then/else
structure is definitely not supported.
You could split that particular example up into two different mount
units tho' I believe.
(using /bin/mount directly is not needed if you define .mount units: see
You could use ConditionPathIsDirectory=/mnt/mymountpoint in one unit and
ConditionPathIsDirectory=!/mnt/mymountpoint in the other.
Mount units have to be named specially after their mount points, so be
careful there e.g. if the mount point is /mnt/mymountpoint then the unit
should be called mnt-mymountpoint.mount
Tribalogic Limited http://www.tribalogic.net/
Mageia Contributor http://www.mageia.org/
PulseAudio Hacker http://www.pulseaudio.org/
Trac Hacker http://trac.edgewall.org/
More information about the systemd-devel