I have a CIFS network share mounted on /etc/fstab at boot on a laptop connected to the wireless network. My fstab looks like this:
//192.168.0.100/MyShare /mnt/MyShare cifs username=<username>,password=<password>,rw,uid=1000,gid=1000,nounix,iocharset=utf8,file_mode=0770,dir_mode=0770,vers=3.0 0 0
Now, that normally works fine, but being a laptop, i move a lot and reconnect to my home wireless network quite often. This means that, when i leave the network, the share mount also disconnects, but when i get back home, it won't reconnect automatically so i need to "mount -a" every time this happens.
I'm looking for an option to automatically mount it on network getting available, or at least mounting automatically upon access (that is, when Dolphin or other file manager accesses the mount point, it should get remounted as root).
Is there any easy way to do this? Any best practice, maybe? Thanks!
Later edit: In the meantime, I found something that i would call a workaround, not a solution, so i'll keep the question opened:
- i created a script in
/etc/network/if-up.d/<script>
to be run upon connecting to my network:
#!/bin/bash
if iwconfig|grep -c <SSID>
then
mount -a
fi
So now, when my connection becomes active, everything gets auto-mounted.