On Wed, Dec 12, 2012 at 12:10 PM, Paul Gideon Dann <pdgiddie@gmail.com> wrote:
I'm trying a mount unit here, because I was hoping there might be a bit more magic to it.
Yes, it is.
However, it does mean that I had to hardcode the mount path (%H doesn't seem to work)
At the moment %H and friends only work on Exec*, I think it would make sense to extend it to work in more places (including Where=).
but if I can get this working, I have a oneshot unit that should take care of that.
As Dave said, maybe a generator would be better.
I created a "sockets-pre.target" unit, ordered before "sockets.target", and the following unit is ordered before that, because I was hoping that might help. It doesn't, presumably because the socket units and this unit are all "before" sockets.target, and all get started at the same time. If the sockets were set "after" sockets-pre.target, this would probably work. (But in that case they might as well be specified directly in the unit, and the sockets-pre target can be dropped.)
[Unit] Description=/var directory for the node DefaultDependencies=false Requires=sockets-pre.target Before=sockets-pre.target
[Mount] What=192.168.0.1:/srv/nfs/cluster-store/vars/node07 Where=/var Type=nfs Options=v3,nolock
[Install] RequiredBy=local-fs.target
I'm not able to reproduce this problem. I don't see the need for sockets-pre.target. It should be possible to simply specify your mount in /etc/fstab (obviously this only works in this test case, as the hostname will be hardcoded), and all sockets should get ordered correctly. Could you try that (remember doing "systemctl daemon-reload" after editing fstab) and then doing "systemctl show <problematic>.socket | grep After" to see if it worked? If it did not, please post the socket unit in question. Cheers, Tom