I have a revolving “client” problem with a server (cifs/samba server) that is located in my home.
The idea is to prepare the mount in fstab (with cifs and automount) and have it mounted ONLY when I need it and open the corresponding directory.
My setup is perfect when the server is ON but problematic when the server is OFF or when I am far from the server. Some of my applications (scribus for instance, detected with journalctl -f`) will intend to connect or connect to the server even if not needed and slow down the workflow, especially when the server is not available.
fstab makes use of the automount option with a line based on
I did try all the possible additional options in fstab I think, after many researches in the web, mount on alternative directories (/run/media or /mnt) as apparently some applications explore /home directories regularly, add the options like noauto and _netdev in the fstab line,… nothing is working.
I am trying to eliminate the fstab line and mount with a script for instance but I am facing other difficulties and would like to have the automount making the job as I understand it would have to.
I did explore autofs also but it is apparently not recommended.
I hope that my explanation is clear enough, thanks in advance for the advises.
[Unit]
Description=Check if Samba Server is reachable
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
ExecStart=/usr/local/bin/ping-server-check.sh
I am testing your solution; the setup of systemd is really new for me and I am trying to understand all this without breaking my system as I see some potential for me.
First tests with a usb key are apparently fine, still without the additional ping script that you propose.
But I am surprised to see that scribus is also calling the usb without reason. Scribus had never known about this usb before. I would like to determine if this is a problem of scribus only or if this is a problem with my system?
journalctl is giving
data-usb.automount: Got automount request for /data/usb, triggered by 78438 (scribus)