Created
November 22, 2014 20:32
-
-
Save Dr4K4n/e9996703bda72ca7e0da to your computer and use it in GitHub Desktop.
change cntlm proxy configuration based on current IP with NetworkManager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DEVICE="$1" | |
ACTION="$2" | |
if [ "$ACTION" = "up" ]; then | |
IP=$(ifconfig ${DEVICE} | grep "inet Adresse" | cut -b 24-32) | |
echo $IP | |
if [ "$IP" = "10.15.225" ]; then | |
echo "We're at Bucher, use dat TC-proxy!" | |
rm /etc/cntlm.conf | |
ln -sf /etc/cntlmbucher.conf /etc/cntlm.conf | |
service cntlm restart | |
else | |
echo "We're NOT at Bucher, free internet!" | |
rm /etc/cntlm.conf | |
ln -sf /etc/cntlmhome.conf /etc/cntlm.conf | |
service cntlm restart | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment