Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit bd5a082

Browse files
Merge pull request #41 from MirandaStreeter/check_for_nc
Checking for netcat, and ensuring the error messages for checking commands sends to standard error instead of standard output
2 parents 2de023f + 1d45524 commit bd5a082

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

view-in-grafana.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ shift $((OPTIND-1))
8383
# VALIDATION
8484
[[ ! -d $1 ]] && { echo "ERROR: First argument must be a directory."; usage; exit 1; }
8585

86-
type docker-compose &>/dev/null || {
87-
echo "ERROR: docker-compose required. Please install docker-compose."
86+
type docker-compose >/dev/null 2>&1 || {
87+
echo >&2 "ERROR: docker-compose required. Please install docker-compose."
8888
exit 1
8989
}
9090

@@ -112,6 +112,10 @@ find "$datadir" -type f -ctime -"${RETENTION_DAYS}" -name "*.bz2" -execdir tar j
112112
find "$datadir" -type f -ctime -"${RETENTION_DAYS}" -name "*.gz" -execdir tar xf "{}" \; 2>/dev/null
113113

114114
echo "Waiting for database to be ready..."
115+
type nc >/dev/null 2>&1 || {
116+
echo >&2 "ERROR: nc required. Please install ncat/netcat."
117+
exit 1
118+
}
115119
timeout=60
116120
until nc -zv 127.0.0.1 2003 &>/dev/null || (( timeout <= 0 )); do
117121
(( timeout-- ))

0 commit comments

Comments
 (0)