Systemd on vivid beta
Tom H
tomh0665 at gmail.com
Fri Mar 20 12:52:24 UTC 2015
On Tue, Mar 17, 2015 at 5:17 PM, Colin Law <clanlaw at gmail.com> wrote:
> On 17 March 2015 at 20:44, Tom H <tomh0665 at gmail.com> wrote:
>> On Sun, Mar 15, 2015 at 7:41 AM, Colin Law <clanlaw at gmail.com> wrote:
>>>
>>> And it does not appear to be making any attempt to retry. If I then
>>> use systemctl start then it does mount.
>>
>> Why are you expecting it to retry automatically?
>>
>> I've never used it but there's "Restart=on-failure".
>
> That is the whole point of my script. As I said in an earlier post, I have a
> dynamic network with devices coming and going, and the script
> automatically mounts/unmounts them as they come and go.
>
> When I asked "Will that automatically mount/unmount if the server
> comes and goes?
> and you replied
> Yes. With ifupdown and NM. I haven't tested it with networkd but I
> assume that it'll be ordered properly with it too.
> That is what I meant. Possibly we have been been talking at cross purposes.
I'm sorry. I either misunderstood you or I didn't read your email
carefully and answered stupidly.
I've tried to use "Restart" but it seems to be illegal in .mount units
and I was unable to get it to work after transforming the .mount unit
into a .service one.
Can you share your sysvinit script? How is it detecting the network's
up/down status?
Another solution is to use NM's dispatcher service (or ifupdown's
up/down/... directories).
In my VM:
# cat /etc/NetworkManager/dispatcher.d/mount-home-th-srvtom
#!/bin/sh
if [ "$2" = up ] ; then
logger "Mounting /home/th/srvtom"
/bin/mount -t cifs -o credentials=/home/th/.cifscreds
//192.168.1.240/srvtom /home/th/srvtom
logger "Mounted /home/th/srvtom"
fi
# cat /etc/NetworkManager/dispatcher.d/pre-down.d/umount-home-th-srvtom
#!/bin/sh
logger "Unmounting /home/th/srvtom"
/bin/umount -l /home/th/srvtom
logger "Unmounted /home/th/srvtom"
# journalctl | grep srvtom
Mar 20 08:33:29 nina logger[793]: Mounting /home/th/srvtom
Mar 20 08:33:29 nina logger[827]: Mounted /home/th/srvtom
Mar 20 08:34:04 nina systemd[1]: Unmounting /home/th/srvtom...
Mar 20 08:34:04 nina systemd[1]: Unmounted /home/th/srvtom.
Mar 20 08:34:08 nina logger[793]: Mounting /home/th/srvtom
Mar 20 08:34:08 nina logger[827]: Mounted /home/th/srvtom
(The "pre-down.d" umount script seems to be ignored. The mysteries of
systemd...)
More information about the ubuntu-users
mailing list