On 14/03/2021 07:14, Patrick O'Callaghan wrote:
On Sun, 2021-03-14 at 06:38 +0800, Ed Greshko wrote:
[root@f33k ~]# systemctl status dock.service ● dock.service - Power the dock up or down Loaded: loaded (/etc/systemd/system/dock.service; static) Active: inactive (dead)
[root@f33k ~]# systemctl start dock.service
[root@f33k ~]# ll /var/tmp/auto total 0 -rw-r--r--. 1 root root 0 Mar 14 06:35 start -rw-r--r--. 1 root root 0 Mar 14 06:35 stop
See the issue?
Your dock.service, if run, would power-up and then immediately power-down the dock.
Indeed. Does that mean I need separate dock-up and dock-down services?
I suppose. But, I can't say that there is a way to start a service went the auto-unmount occurs.
Also, the .service is not being invoked by the .mount (I shouldn't have to start it manually), presumably because the .automount isn't running.
I modified my aux.mount unit to be
[Unit] Description=nfs mount aux Wants=dock.service
[Mount] What=[2001:b030:112f::19]:/volume1/aux Where=/aux Options=rw,noauto,soft,fg,x-systemd.mount-timeout=30 Type=nfs4
[Install] WantedBy=multi-user.target
It then rebooted and.....
[egreshko@f33k ~]$ ll /var/tmp/auto/ total 0 -rw-r--r--. 1 root root 0 Mar 14 07:26 start -rw-r--r--. 1 root root 0 Mar 14 07:26 stop
I then waited until it unmounted and accessed the share.
[egreshko@f33k ~]$ ll /var/tmp/auto/ total 0 -rw-r--r--. 1 root root 0 Mar 14 07:33 start -rw-r--r--. 1 root root 0 Mar 14 07:33 stop
So, it is working as expected for me.
You may wish to try "crawling" first?
BTW, is there a recommended way to re-run this kind of test cleanly, without having to reboot the system, e.g. after modifying one the various unit files? I know about systemd daemon-reload but that doesn't seem to be enough.
I used "systemd daemon-reload" in this test without a problem.