Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression for the case of COSMOVISOR_ENABLED without START_CMD #572

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ export PROJECT_DIR="${PROJECT_DIR:-.$PROJECT_BIN}"
export CONFIG_DIR="${CONFIG_DIR:-config}"
if [ "$COSMOVISOR_ENABLED" == "1" ]; then
PREFIX_CMD="cosmovisor run"
DEFAULT_CMD=""
elif [ -n "$SNAPSHOT_PATH" ]; then
PREFIX_CMD="snapshot.sh"
DEFAULT_CMD="$PROJECT_BIN"
else
PREFIX_CMD=
DEFAULT_CMD="$PROJECT_BIN"
fi
export PROJECT_ROOT="/root/$PROJECT_DIR"
export CONFIG_PATH="${CONFIG_PATH:-$PROJECT_ROOT/$CONFIG_DIR}"
Expand Down Expand Up @@ -353,10 +356,12 @@ if [[ ! -f "$PROJECT_ROOT/data/priv_validator_state.json" ]]; then
echo '{"height":"0","round":0,"step":0}' > "$PROJECT_ROOT/data/priv_validator_state.json"
fi

# use command line args if explicit given, else START_CMD if explicitly set,
# or else DEFAULT_CMD (as set for the selecetd PREFIX_CMD).
if [ "$#" -ne 0 ]; then
exec $PREFIX_CMD "$@"
elif [ -n "$START_CMD" ]; then
exec $PREFIX_CMD $START_CMD
else
exec $PREFIX_CMD $PROJECT_BIN start
exec $PREFIX_CMD $DEFAULT_CMD start
fi