
プロキシが正しく機能しているかどうかをテストするには、スクリプトが必要です。 Sciptはwgetを使用してページをダウンロードし、grepを使用して特定の文字列を取得する必要があります。文字列が見つからない場合は、特定のアドレスに電子メールを送信する必要があります。文字列が見つかるかどうかを判断する部分に問題があります。 http_proxy = 'エクスポートhttp://proxy.test.cz:1234/'
wget -nvq --proxy-user=test --proxy-password=test google.com &>/dev/null | grep -q '<H1>you cant't use internet</H1>' || ( echo "Proxy isnt't working" | mail -s "Proxy isnt't working!!!" -r "No-reply<[email protected]>" [email protected] )
答え1
wget -q --spider ${URL}
if [ $? = 0 ]
then
STATUS="UP"
else
STATUS="DOWN"
fi
echo $STATUS
ステータス値に基づいて電子メールを送信します。