serve_http() { lightpid=$((10000 + $$ % 30000)) cat > light.conf < /dev/null 2>&1 || exit 200 baseurl="http://localhost:$lightpid" } finish_http() { test -e "$1/light.pid" && kill `cat "$1/light.pid"` || true } check_remote_http() { if ! curl -fI "$1"; then echo Cannot reach "$1" exit 200 fi }