/ Published in: Bash
updated...
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/bin/bash gateway=$(ip route show 0.0.0.0/0 | awk '{print $3}') mactest=$(arp -n -a $gateway | awk '{print $4}') targetmac="XX:XX:XX:XX:XX:XX" homeup="mount -t cifs -o username=USER,password=PASSWORD //SERVER/SHARE /mnt/remote" awayup="sshfs my.dyndns.tld:/path/to/share /mnt/remote" down="umount -l /mnt/remote" if [ $mactest==$targetmac ] then case "$2" in up) $homeup ;; down) $down ;; esac else case "$2" in up) $awayup ;; down) $down ;; esac fi exit $?
URL: http://nathanewilliams.com/