とあるURLのステータスコード
至ってシンプルに、200とか、404とか取得したいなー。と。
curl -LI [URL] -o /dev/null -w '%{http_code}\n' -s
で取得できまする。
e.g.
curl -LI https://www.favy.jp/hogehoge -o /dev/null -w '%{http_code}\n' -s
とある複数URLのステータスチェック
curl -LI [URL1] -o /dev/null -w '%{http_code}\n' -s >> tmp.txt
を複数行に渡って書いたシェルファイルを作って実行しよう。
vim test.sh
test.sh
curl -LI https://www.favy.jp/hogehoge -o /dev/null -w '%{http_code}\n' -s >> tmp.txt
curl -LI https://www.favy.jp/hogehoge2 -o /dev/null -w '%{http_code}\n' -s >> tmp.txt
curl -LI https://www.favy.jp/hogehoge3 -o /dev/null -w '%{http_code}\n' -s >> tmp.txt
curl -LI https://www.favy.jp/hogehoge4 -o /dev/null -w '%{http_code}\n' -s >> tmp.txt
・
・
チェックはこれで。
less +F tmp.txt
(tail -f tmp.txt)
※あまり大量にやっちゃ駄目よ。