I wanted to make my laptop running Ubuntu automatically mount a Samba share whenever it connected to my wireless home network. I quickly discovered the /etc/network/if-up.d
and /etc/network/if-down.d
folders which contain scripts that are run whenever a network interface is started or stopped.
I devised the following simple scripts to mount and dismount the share when needed: