#!/bin/sh usage() { echo "Usage : $0 [OPTIONS] -h --help : display this help and exit -c --continue : continue after a failure -n --no-color : disable uses of tput to display colors -v --verbose : increase verbosity level" } verbose=0 exit_on_fail=1 color=1 OPTS=$(getopt -o vcnh --long verbose,continue,no-color,help: -n 'parse-options' -- "$@") if [ "$?" -ne "0" ] then echo "" usage exit 1 fi for o in $OPTS do case "$o" in -v | --verbose ) verbose=$(expr $verbose + 1);; -c | --continue ) exit_on_fail=0;; -n | --no-color ) color=0;; -h | --help ) usage; exit 0;; -- ) break;; *) echo "Unknown argument '$1'" >&2; usage exit 1;; esac done export color export verbose export exit_on_fail . ./check.sh # Initialize tests CHECK_START # Init testcase with title and description TC_INIT "Ping check" "Send ping to some hosts" # Needs ping TC_RUN check_ping gnu.org 2 TC_RUN check_ping localhost TC_END TC_INIT "SSH" "Testing ssh server" # Needs netcat TC_RUN check_ssh_nc ssh.cluster007.ovh.net TC_RUN check_ssh_key ssh.cluster007.ovh.net 'AAAAB3NzaC1yc2EAAAADAQABAAABAQCxTdeGLZ7JYXj6XbxlRSK5YXxfgD3HMmaXFtsM+jMZXKAVG6wLBTaLS3CqhUbtuFNs/or6geS1tban33x2nyGn283Wbf3x1PS1cgg9fBAd9tQNsZZ7pEJ6shqv4Lnv+cHRdgNPrGnEim/eUs3H7ZOd5CuCpaoDV31XD+klwCAu/ANq+GiX4iarER59Ij6xd736r+kYAWbguZCV0lL91ag5g6+vVvufHngr6HY5rvl1Ybw1nSfzEG4+UYl5EwvWFSuxPq706DV1kUDmQ17GkD/z0GzBdPDMzgQSLEVvT3CBqAqrosGZO2Iap8EOLDBd/h6ZWWsO2EjEadJJXb23xwhr' TC_END TC_INIT "HTTP/HTTPS" "Testing HTTP status & HTTPS cert" # Needs curl TC_RUN check_https_cert gnu.org TC_RUN check_http_200 http://www.gnu.org/index.html TC_RUN check_http_status http://www.gnu.org/sqdsqdk.foo 404 TC_RUN check_http_status http://gnu.org/ 301 TC_END TC_INIT "HTML" # Needs xsltproc TC_RUN check_html_title http://www.gnu.org/ "The GNU Operating System and the Free Software Movement" TC_END TC_INIT "Git" "Try to clone a git repo" # Needs git TC_RUN check_git_repo https://git.yannweb.net/yannweb/mhssh.git TC_END TC_INIT "Audio streaming" "Testing audio stream" # Needs mplayer TC_RUN check_audiostream http://zmpd.zered.net:8042/fip-metadata.mp3 TC_RUN check_audiostream http://ice1.somafm.com/missioncontrol-128-mp3 256kb TC_END # Display results CHECK_REPORT