Ensure sqlite.db exists before querying it; Execute so-elastic-auth after common state has been applied and redirect output to setup log

This commit is contained in:
Jason Ertel
2021-06-15 16:57:13 -04:00
parent b95437347e
commit 989f9dce42
2 changed files with 5 additions and 2 deletions

View File

@@ -232,7 +232,7 @@ function syncElastic() {
}
function syncAll() {
if [[ -n "$STALE_MIN" ]]; then
if [[ -n "$STALE_MIN" && -f "$databasePath" ]]; then
staleCount=$(echo "select count(*) from identity_credentials where updated_at >= Datetime('now', '-${STALE_MIN} minutes');" \
| sqlite3 "$databasePath")
if [[ "$staleCount" == "0" ]]; then