Skip to content

Instantly share code, notes, and snippets.

@takuya-i
Last active December 14, 2015 04:49
Show Gist options
  • Save takuya-i/5031075 to your computer and use it in GitHub Desktop.
Save takuya-i/5031075 to your computer and use it in GitHub Desktop.
AU光の契約で配られているルータが、ローカルLANからグローバルIP指定し、サーバアクセスすると、 接続できないんで、それを判別し、ssgfsで自動マウントするスクリプト。(OSX 専用 ) サーバあるんだったら、DNS立てろというのはなしはなしで.....
#!/bin/sh
#
# check Home Local LAN or other place, wifi or company office
# if access from home LAN, out Home LAN IP address, otherwise return global IP addrress
# Author Takuya Inoue
#GROBAL IP address
IP_ADDR=xxx.xxx.xxx.xxx
# network is 192.168.0.0/24
if [ `uname` = "Darwin" ] && [ -n "`ifconfig -a |awk '/192.168.0.*/ {print $2}'`" ] ; then
IP_ADDR="192.168.0.10" # Server IP at home LAN.
fi
MOUNT_DIR=~/Desktop/mntsshfs
if [ ! -d $MOUNT_DIR ]
then
mkdir $MOUNT_DIR
fi
sshfs -p 22 admin@${IP_ADDR}:/data ~/Desktop/mntsshfs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment