-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from marciogranzotto/marcio/fix-mongodb
Fix MongoDB failing to init
- Loading branch information
Showing
3 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/with-contenv bash | ||
# ============================================================================== | ||
# Gracefully stop MongoDB | ||
# ============================================================================== | ||
|
||
# Send the SIGTERM signal to MongoDB to allow it to perform a graceful shutdown | ||
pkill -SIGTERM mongod | ||
|
||
# Wait for MongoDB to shut down | ||
timeout 30 sh -c 'until [ "$(pgrep mongod)" = "" ]; do sleep 1; done' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/with-contenv bashio | ||
# ============================================================================== | ||
# Home Assistant Add-on: Nightscout | ||
# Runs MongoDB | ||
# ============================================================================== | ||
|
||
bashio::log.info "Starting MongoDB..." | ||
|
||
# Set the data directory and bind IP address | ||
export MONGODB_DBPATH="/var/lib/mongodb" | ||
export MONGODB_BIND_IP="127.0.0.1" | ||
|
||
# Start MongoDB with the specified options | ||
exec s6-setuidgid mongodb /usr/bin/mongod --dbpath "$MONGODB_DBPATH" --bind_ip "$MONGODB_BIND_IP" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters