Add check for empty URL in promise

parent f33ad971
......@@ -3,14 +3,20 @@
# BEWARE: It will be overwritten automatically
URL="%(url)s"
if [ -z $URL ]; then
echo "No URL specified." >&2
exit 3
fi
CODE=$(%(curl_path)s -k -sL $URL -w %%{http_code} -o /dev/null)
if [ $CODE -eq 000 ]; then
echo "$URL is not available (server not reachable)" >&2
echo "$URL is not available (server not reachable)." >&2
exit 1
fi
if ! [ $CODE -eq 200 ]; then
echo "$URL is not available (returned $CODE)" >&2
echo "$URL is not available (returned $CODE)." >&2
exit 2
fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment