Skip to content

Commit

Permalink
Merge pull request #23 from linuxserver/check-for-mongo-reachability
Browse files Browse the repository at this point in the history
check for mongodb reachability during init
  • Loading branch information
drizuid authored Oct 16, 2023
2 parents 2056f9a + c15cb33 commit ec5536d
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ done
if [[ ! -e /config/data/system.properties ]]; then
if [[ -z "${MONGO_HOST}" ]]; then
echo "*** No MONGO_HOST set, cannot configure database settings. ***"
exit 1
sleep infinity
elif ! nc -w1 "${MONGO_HOST}" ${MONGO_PORT} >/dev/null 2>&1; then
echo "*** Defined MONGO_HOST is not reachable, cannot proceed. ***"
sleep infinity
else
sed -i "s/~MONGO_USER~/${MONGO_USER}/" /defaults/system.properties
sed -i "s/~MONGO_HOST~/${MONGO_HOST}/" /defaults/system.properties
Expand Down

0 comments on commit ec5536d

Please sign in to comment.