3 # http://askubuntu.com/questions/53443/how-do-i-ignore-a-proxy-if-not-available
4 # altered because testing a down proxy takes like 2 seconds,
5 # and we would do it like 100 times in a row. so cache a failed result
6 # locally for 10 minutes. Also, using newer option based on man apt.conf.
8 # Once when I was testing, it seemed I needed to have it output
9 # DIRECT after toutputing the proxy url
12 proxy_url
=http
://$proxy_host:$proxy_port/
14 if [[ ! -w /tmp
]]; then
18 modtime
=$
(stat
-c %Y
$f 2>/dev
/null
) ||
:
19 if [[ $modtime ]] && (( $
(( $
(date +%s
) - modtime
)) < 60*10 )); then
25 if getent hosts
$proxy_host &>/dev
/null
&& timeout
1 nc
-z $proxy_host $proxy_port &>/dev
/null
; then
28 if [[ ! -e $f ||
-w $f ]]; then