scripts/FreeBSD/url-check.csh

23 lines
444 B
Tcsh
Raw Normal View History

2020-05-23 18:12:16 +02:00
#!/bin/csh -f
2020-05-23 18:59:02 +02:00
set MODE=$1
if ($MODE == no_auth) then
set URL=$2
set HS=$3
set STATUS=`curl -L -o /dev/null -s -w "%{http_code}\n" -m 1 $URL`
else if ($MODE == auth) then
set AUTH=$2
set URL=$3
set HS=$4
set STATUS=`curl -L -o /dev/null -s -w "%{http_code}\n" -m 1 --user $AUTH $URL`
else
exit 1
endif
2020-05-23 18:12:16 +02:00
if ($STATUS == 200) then
/usr/local/bin/curl -fsS --retry 3 $HS > /dev/null
else
exit 1
2020-05-23 18:59:02 +02:00
endif