touch proxyon.txt:
export http_proxy=http://172.16.1.15:8080
export no_proxy="127.0.0.1,localhost,.localdomain.com"
export https_proxy=$http_proxy \
ftp_proxy=$http_proxy \
rsync_proxy=$http_proxy \
all_proxy=$http_proxy \
HTTP_PROXY=$http_proxy \
HTTPS_PROXY=$http_proxy \
FTP_PROXY=$http_proxy \
RSYNC_PROXY=$http_proxy \
ALL_PROXY=$http_proxy \
NO_PROXY=$no_proxy
echo "Proxy enabled: ${http_proxy}"
touch proxyoff.txt:
unset http_proxy https_proxy ftp_proxy rsync_proxy all_proxy HTTP_PROXY HTTPS_PROXY FTP_PROXY RSYNC_PROXY ALL_PROXY
echo "Proxy disabled"
source proxyon
source proxyoff
To automatically set the system proxy after login:
sudo ln -s /usr/local/bin/proxy-on /etc/profile.d/proxy.sh
set git proxy:
git config --global http.proxy (172.16.1.12:8080)url:port
git config --global https.proxy url:port