Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export http_proxy='http://proxy.test.cz:1234/'
- OUTPUT_FILE=/tmp/$$.txt
- wget -nv --proxy-user=test --proxy-password=test google.com > ${OUTPUT_FILE} 2>&1
- grep -q '<H1>You cant use internet</H1>' ${OUTPUT_FILE}
- if [ "$?" -eq '0' ]
- then
- echo "Proxy isnt working. " | mail -s "Proxy isnt working" -r "No-reply<no-reply@mail.cz>" test@mail.cz
- else
- echo "Proxy is working"
- fi
- rm -f /tmp/$$.txt
- if [ "$?" -eq '0' ]
- if [ "1" -eq '0' ]
- if [ $? -eq 0 ]
- export http_proxy='http://proxy.test.cz:1234/'
- URL='www.google.com'
- wget -q --proxy-user=test --proxy-password=test --spider $URL
- if [ $? = 1 ]
- then
- STATUS= echo "Proxy isn't working"
- else
- STATUS="Proxy is working."
- fi
- echo $STATUS
- set_proxies() {
- export http_proxy=http://proxy.example.com:998
- export HTTP_PROXY=${http_proxy}
- export https_proxy=http://proxy.example.com:999
- export HTTPS_PROXY=${https_proxy}
- export ftp_proxy=http://proxy.example.com:998
- export FTP_PROXY=${ftp_proxy}
- export socks_proxy=socks://proxy.example.com:9999
- export SOCKS_PROXY=${socks_proxy}
- export no_proxy=localhost,127.0.0.1,.docker.io,192.168.9.100
- export NO_PROXY=${no_proxy}
- export ALL_PROXY_NO_FALLBACK=1
- export all_proxy=socks5://proxy.example.com:9999
- }
- URL='www.google.com'
- curl -s -m 2 $URL > /dev/null
- if [ $? == 0 ] then
- STATUS="No Corporate Proxy"
- else
- set_proxies
- STATUS="Behind Corporate proxy"
- fi
- echo $STATUS
Add Comment
Please, Sign In to add comment