Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
4k
Issue boards
Milestones
Code
Merge requests
450
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC
Commits
3b19ccec
Commit
3b19ccec
authored
5 years ago
by
Marvin Scholz
Browse files
Options
Downloads
Patches
Plain Diff
CI: Add script to check existence of URL
parent
2d67599a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
extras/ci/check-url.sh
+40
-0
40 additions, 0 deletions
extras/ci/check-url.sh
with
40 additions
and
0 deletions
extras/ci/check-url.sh
0 → 100755
+
40
−
0
View file @
3b19ccec
#!/usr/bin/env bash
# Copyright (C) Marvin Scholz
#
# License: see COPYING
#
# Check if a given URL exists or not
set
-e
# Print error message and terminate script with status 1
# Arguments:
# Message to print
abort_err
()
{
echo
"ERROR:
$1
"
>
&2
exit
1
}
# Return the HTTP status code for a specific URL
# Arguments:
# URL
# Globals:
# HTTP_STATUS_CODE
get_http_status
()
{
HTTP_STATUS_CODE
=
$(
curl
-s
-o
/dev/null
-L
-I
-w
"%{http_code}"
"
$1
"
)
}
command
-v
"curl"
>
/dev/null 2>&1
||
abort_err
"cURL was not found!"
if
[
$#
-eq
0
]
;
then
abort_err
"No URL to check provided!"
fi
get_http_status
"
$1
"
if
[
"
$HTTP_STATUS_CODE
"
-eq
200
]
;
then
true
else
abort_err
"'
$1
' returned HTTP Status Code '
$HTTP_STATUS_CODE
'"
fi
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment