run.sh 773 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. PROFILE="${PROFILE:-emqx}"
  4. EMQX_ROOT="${EMQX_ROOT:-_build/$PROFILE/rel/emqx}"
  5. EMQX_WAIT_FOR_START="${EMQX_WAIT_FOR_START:-30}"
  6. export EMQX_WAIT_FOR_START
  7. start_emqx_with_conf() {
  8. echo "Starting $PROFILE with $1"
  9. "$EMQX_ROOT"/bin/emqx start
  10. "$EMQX_ROOT"/bin/emqx stop
  11. }
  12. MAJOR_VSN=$(./pkg-vsn.sh "$PROFILE" | cut -d. -f1)
  13. if [ "$PROFILE" = "emqx" ]; then
  14. PREFIX="v"
  15. else
  16. PREFIX="e"
  17. fi
  18. FILES=$(ls ./scripts/conf-test/old-confs/"${PREFIX}${MAJOR_VSN}"*)
  19. cp "$EMQX_ROOT"/etc/emqx.conf "$EMQX_ROOT"/etc/emqx.conf.bak
  20. cleanup() {
  21. cp "$EMQX_ROOT"/etc/emqx.conf.bak "$EMQX_ROOT"/etc/emqx.conf
  22. }
  23. trap cleanup EXIT
  24. for file in $FILES; do
  25. cp "$file" "$EMQX_ROOT"/etc/emqx.conf
  26. start_emqx_with_conf "$file"
  27. done