Browse Source

Add options support + http unification

Deleted specific http and https methods
Yann Weber 6 years ago
parent
commit
7be85e8915
1 changed files with 22 additions and 17 deletions
  1. 22
    17
      check.sh

+ 22
- 17
check.sh View File

@@ -16,11 +16,20 @@
16 16
 #along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 17
 
18 18
 
19
-alias echo="/bin/echo -e"
19
+if [ -z "$color" ]
20
+then
21
+	color=1
22
+fi
23
+if [ -z "$verbose" ]
24
+then
25
+	verbose=1
26
+fi
27
+if [ -z "$exit_on_fail" ]
28
+then
29
+	exit_on_fail=1
30
+fi
20 31
 
21
-color=1
22
-verbose=2
23
-exit_on_fail=0
32
+alias echo="/bin/echo -e"
24 33
 
25 34
 col_reset() {
26 35
 	if [ "$color" -gt 0 ]
@@ -225,21 +234,11 @@ _check_http_status() {
225 234
 check_http_status() {
226 235
 	# $1 url
227 236
 	# $2 status
228
-	_check_http_status http://$1 $2
237
+	_check_http_status $1 $2
229 238
 }
230 239
 
231 240
 check_http_200() {
232
-	_check_http_status http://$1 200
233
-}
234
-
235
-check_https_status() {
236
-	# $1 url
237
-	# $2 status
238
-	_check_http_status https://$1 $2
239
-}
240
-
241
-check_https_200() {
242
-	_check_http_status https://$1 200
241
+	_check_http_status $1 200
243 242
 }
244 243
 
245 244
 check_https_cert() {
@@ -298,8 +297,14 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
298 297
 check_audiostream() {
299 298
 	# Uses mplayer to fetch 128Kb of stream
300 299
 	# $1 Stream URL
300
+	# $2 size
301 301
 	tmpfile=$(mktemp -t check_audiostream.XXXXXXXXX)
302
-	sz="128kb"
302
+	
303
+	sz="$2"
304
+	if [ -z "$sz" ]
305
+	then
306
+		sz="128kb"
307
+	fi
303 308
 	if [ "$verbose" -gt 1 ]
304 309
 	then
305 310
 		logdate INFO "$tc_name: Running mplayer on '$1' for $sz" 3

Loading…
Cancel
Save