From 2796c1c7e569f60c868312513fb48272b4e8fc9e Mon Sep 17 00:00:00 2001 From: ALinuxNinja Date: Thu, 27 Apr 2017 19:00:19 -0400 Subject: [PATCH] fix binding --- scripts/start.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/start.sh b/scripts/start.sh index 2a01ed0..79383d9 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -29,13 +29,19 @@ sed -i -e '/rabbitmq:/!b' -e ':a' -e "s/username.*/username: $RABBITMQ_DEFAULT_U sed -i -e '/rabbitmq:/!b' -e ':a' -e "s/password.*/password: $RABBITMQ_DEFAULT_PASS/;t trail" -e 'n;ba' -e ':trail' -e 'n;btrail' /opt/postal/config/postal.yml sed -i -e '/rabbitmq:/!b' -e ':a' -e "s/vhost.*/vhost: \/$RABBITMQ_DEFAULT_VHOST/;t trail" -e 'n;ba' -e ':trail' -e 'n;btrail' /opt/postal/config/postal.yml +## Clean Up +rm -rf /opt/postal/tmp/pids/* + ## Initialize DB echo "== Waiting for MySQL to start up ==" while ! mysqladmin ping -h mysql --silent; do sleep 1 done -/opt/postal/bin/postal upgrade - +if [[ $(mysql -h mysql -uroot -p$MYSQL_ROOT_PASSWORD -s --skip-column-names -e "SELECT COUNT(DISTINCT table_name) FROM information_schema.columns WHERE table_schema = 'postal'") == 0 ]]; then + /opt/postal/bin/postal initialize +else + /opt/postal/bin/postal upgrade +fi ## Run /opt/postal/bin/postal run