Skip to content

Commit

Permalink
wip -- misc wrap_datamon_pg dbgging
Browse files Browse the repository at this point in the history
  • Loading branch information
ransomw1c committed Sep 26, 2019
1 parent 776fc54 commit 9256d13
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions hack/fuse-demo/wrap_datamon_pg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,15 @@ for pg_db_id in $PG_DB_IDS; do
unsetopt ERR_EXIT
>${log_file_pg} 2>${log_file_pg_err} \
postgres -D $data_dir -p $PG_DB_PORTS[$pg_db_id] &
pg_pid=$!
pg_status=$?
pg_pids[$pg_db_id]=$!
setopt ERR_EXIT
if [[ ! $pg_status -eq 0 ]]; then
cat ${log_file_pg}
cat ${log_file_pg_err}
terminate "error starting postgres"
fi
pg_pids[$pg_db_id]=$pg_pid
while ! &>/dev/null createuser -p $PG_DB_PORTS[$pg_db_id] -s $PG_SU; do
print "waiting on ${pg_db_id} db start..."
sleep $POLL_INTERVAL
Expand All @@ -279,6 +280,10 @@ for pg_db_id in $PG_DB_IDS; do
stop_postgres $pg_pids[$pg_db_id]
done

# todo: dumb timout on postgres shutdown
dbg_print "dumb timeout on postgres shutdown"
sleep 10

dbg_print "uploading data directories"

if [[ -e ${UPLOAD_STAGE} ]]; then
Expand All @@ -291,8 +296,10 @@ for pg_db_id in $PG_DB_IDS; do
mkdir ${UPLOAD_STAGE}/${BP_DATA}
dbg_print "prepare staging area"
data_dir=${PG_DATA_DIR_ROOT}/${pg_db_id}
(cd $data_dir && tar -cvf ${UPLOAD_STAGE}/${BP_PG_TAR} *)
print -- ${PG_VERSION} > ${BP_PG_VERSION}
(cd $data_dir && \
>${LOG_ROOT}/tar.${pg_db_id}.log 2>${LOG_ROOT}/tar_err.${pg_db_id}.log \
tar -cvf ${UPLOAD_STAGE}/${BP_PG_TAR} *)
print -- ${PG_VERSION} > ${UPLOAD_STAGE}/${BP_PG_VERSION}
dbg_print "perform upload"
log_file_upload=${LOG_ROOT}/datamon_upload.${upload_idx}.log
upload_params=(bundle upload \
Expand Down

0 comments on commit 9256d13

Please sign in to comment.