You are not logged in.
Hi everybody
I've been working on a problem for some time now. I'm writing a dispatcher script that mounts my shares based on my location (I'm traveling between home and school). There are some scritps on this board that try to guess the location based on the ESSID. This would work, not in all cases. Sometimes I connect to the network by ethernet cable, which causes this approach to fail.
My next approach was to figure out the domain suffix of the dhcp server (if there is something like that) but I could not get the information out of any dhcpcd files (like the .lease files).
Maybe someone can provide me with information about dhcpcd or another approach. I'd really appreciate it. Thanks in advance.
Offline
Ok, solved it different: with a ping.
#!/bin/bash
#
# Override /etc/resolv.conf and tell
# NetworkManagerDispatcher to go pluck itself.
#
# scripts in the /etc/NetworkManager/dispatcher.d/ directory
# are called alphabetically and are passed two parameters:
# $1 is the interface name, and $2 is “up†or “down†as the
# case may be.
# Here, no matter what interface or state, override the
# created resolver config with my config.
INTERFACE=$1
ACTION=$2
case "$2" in
up) log_action
#Ping Home
ping -c 3 host.domain.local > /dev/null
if [ $? -eq 0 ]; then
{
mount -t cifs -o username=user,password=xxx,gid=users,nosuid,noatime //host.domain.local/Share /mnt/home/share
}
fi
#repeat if necessary
;;
down)
;;
pre-up)
;;
post-down)
;;
*)
echo $"Usage: $0 {up|down|pre-up|post-down}"
exit 1
esac
Offline