20 lines
347 B
Bash
Executable File
20 lines
347 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [[ "$REQUEST_PATH_SANE" =~ ^status ]]; then
|
|
ip=$(echo "$REQUEST_PATH_SANE" | cut -d '/' -f2)
|
|
|
|
if [ ! -r "status/$ip" ]; then
|
|
body="{\n\"status\": \"unknown\"\n}\n"
|
|
else
|
|
body=$(cat status/$ip)
|
|
fi
|
|
|
|
cat <<EOF
|
|
$($BASHSERV_DIR/header.sh -t "application/json" -l $(echo -e "$body" | wc -c))
|
|
$body
|
|
EOF
|
|
exit 0
|
|
fi
|
|
|
|
exit 1
|