Systemd on vivid beta

Colin Law clanlaw at gmail.com
Fri Mar 20 13:41:27 UTC 2015


On 20 March 2015 at 12:52, Tom H <tomh0665 at gmail.com> wrote:
> ...
> Can you share your sysvinit script? How is it detecting the network's
> up/down status?

It is not only a matter of detecting the network's up/down status, as
it also has to cope with the remote server being offline.  It just
pings the server once a minute and if successful then mounts it, or
vice versa.

>
> Another solution is to use NM's dispatcher service (or ifupdown's
> up/down/... directories).

Having thought about it more I suspect there is no solution that does
not involve trying to contact the server, as I suspect there is no
other way to check whether it is still there.  The script is working
well though, now that the network manager service file has been fixed,
though I gather there is still a problem with the service for wireless
connections.

Colin

>
> 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...)
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users




More information about the ubuntu-users mailing list