[systemd-devel] help with dependicies
John Davis
davisjf at gmail.com
Thu Dec 5 11:25:01 PST 2013
Hello
I have four unit files.
1. xxx.target
2. tmp-testy.mount
3. tmp-testy_ro.mount
4. temp-testy_rw.mount
I want the xxx.target to automatically start the three .mount unit files on
boot. Item, 2. tmp-testy is a union mount of the two unit files 3. and 4.
In order to get this to work,
I have to specify all three .mount files in the requires= and after=
sections in the
.target unit file.
I was thinking that I would only need to specify item 2. in the xxx.target
unit file and
that item 2. would specify it needed item 3 and 4. However this does not
work.
Here are the contents of the four unit files, at the end is a unit file as
it works and how I thought it would work, but alas is does not.
================================================
[root at xxx ~]# cat /lib/systemd/system/tmp-testy.mount
[Unit]
Description=The /tmp/testy unionfs Directory
Before=local-fs.target
[Mount]
What=funionfs#none
Where=/tmp/testy
Type=fuse
FsckPassNo=0
Options=dirs=/tmp/testy_ro=RO:/tmp/testy_rw,allow_other,nonempty
Requires=tmp-testy_ro.mount tmp-testy_rw.mount
After=tmp-testy_ro.mount tmp-testy_rw.mount
=================================================
[root at xxx ~]# cat /lib/systemd/system/tmp-testy_ro.mount
[Unit]
Description=Mount control of testy_ro Directory
Before=tmp-testy.mount
[Mount]
Where=/tmp/testy_ro
What=/tmp/mnt/hp_tools/Hewlett-Packard/HV/testy-ro.bin
Options=loop,ro
=================================================
[root at xxxx ~]# cat /lib/systemd/system/tmp-testy_rw.mount
[Unit]
Description=Mount control of testy_rw Directory
Before=tmp-testy.mount
[Mount]
Where=/tmp/testy_rw
What=tmpfs
Type=tmpfs
Options=size=1M,nr_inodes=1k,mode=755
=================================================
This works
[root at xxxx ~]# cat /lib/systemd/system/xxx.target
[Unit]
Description=xxxxx System
Documentation=man:systemd.special(7)
Requires=tmp-testy_rw.mount tmp-testy_ro.mount tmp-testy.mount etc.mount
Wants=sshd.service
After=tmp-testy_rw.mount tmp-testy_ro.mount tmp-testy.mount etc.mount
RefuseManualStart=yes
[root at xxx ~]#
This does not. It will mount /tmp/testy but /tmp/testy_ro and /tmp/testy_rw
will not be mounted.
[root at xxxx ~]# cat /lib/systemd/system/xxx2.target
[Unit]
Description=xxxxx System
Documentation=man:systemd.special(7)
Requires=tmp-testy.mount etc.mount
Wants=sshd.service
After=tmp-testy.mount etc.mount
RefuseManualStart=yes
[root at xxx ~]#
--
John F. Davis
6 Kandes Court
Durham, NC 27713
919-888-8358
独树一帜
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20131205/8bb9efff/attachment.html>
More information about the systemd-devel
mailing list