Linux – Bind Mount Only if Samba Mount is Present

bindlinuxmountnfssamba

I have a mount with SAMBA using the following in fstab:

//source/files /mnt/files cifs user,_netdev,cache=none,credentials=/usr/src/access.smb 0 0

And then i have the following mount –bind line:

/mnt/files /var/www/html/data none defaults,bind 0 0

But the second mount is not working. If i reboot the computer only the first mount works.
I need to manually mount the second one (Using bind)

Please, can someone help me?
I saw this post on Unix Stack Exchange but i did'nt understand: https://unix.stackexchange.com/questions/216287/how-do-i-set-up-bind-mounts-on-startup-correctly-in-the-systemd-world

Thanks in advance.

Best Answer

Something like this:

/mnt/files /var/www/html/data none x-systemd.requires=/mnt/files,x-systemd.automount,bind 0 0