16b9fd82f0
* update for making it work with systemd * take DB_BACKEND from file name; reduce duplicated code; configure db_type=sqlite * define PACKAGE_TESTING Co-authored-by: sabban <15465465+sabban@users.noreply.github.com> Co-authored-by: mmetc <92726601+mmetc@users.noreply.github.com>
32 lines
458 B
Bash
Executable file
32 lines
458 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -eu
|
|
script_name=$0
|
|
|
|
die() {
|
|
echo >&2 "$@"
|
|
exit 1
|
|
}
|
|
|
|
about() {
|
|
die "usage: $script_name <port_number>"
|
|
}
|
|
|
|
[ $# -lt 1 ] && about
|
|
|
|
port_number=$1
|
|
|
|
for _ in $(seq 40); do
|
|
nc -z localhost "$port_number" >/dev/null 2>&1 && exit 0
|
|
sleep .05
|
|
done
|
|
|
|
# send to &3 if open
|
|
if { true >&3; } 2>/dev/null; then
|
|
echo "Can't connect to port $port_number" >&3
|
|
else
|
|
echo "Can't connect to port $port_number" >&2
|
|
fi
|
|
|
|
exit 1
|
|
|