You could also look at udev if it is installed. This permits actions to take place when a device is added or removed; such as when a network interface comes up. To see this in action look in the files that cover network access in /etc/udev/rules.d/ (called 77-network.rules on my SuSE box). You can define actions when an interface goes up/down:
/etc/udev/rules.d/77-network.rules
#
SUBSYSTEM=="net",
ENV{INTERFACE}=="ppp*|ippp*|isdn*|plip*|lo*|irda*|dummy*|ipsec*|tun*|tap*|bond*|br*|vlan*|modem*|dsl*",GOTO="skip_ifup"
SUBSYSTEM=="net", ACTION=="add", RUN+="/sbin/ifup $env{INTERFACE} -o hotplug"
SUBSYSTEM=="net", ACTION=="remove", RUN+="/sbin/ifdown %k -o hotplug"
LABEL="skip_ifup"
(the “ENV(INTERF....” line is used to ignore non-standard network interfaces, if matched it jumps to the corresponding LABEL statement. The SUBSYTEM lines are triggered when the ACTION statement matches – i.e. an interface is ADDed or REMOVed”)
So, if you change the “add/remove” ACTION to call your script, which would call ifup/ifdown then run whatever else you want to after that. .e.g. call “ifup $@” then check interface IP and mount corresponding entries. If the mounts were listed in fstab with the “noauto” option then you only need a simple naming convention to locate the entry and issue a mount.
In a similar fashion the script /etc/udev/rules.d/56-idedma.rules covers IDE (or sata drives) and would be run when the drives are detected. This script would allow local mounts to be initiated based on presence, using an alternate RUN script.
The naming and ordering of rules is similar to that used in the init system. Have a look at the help and rule files for more examples and options.