Skip to content

Commit

Permalink
Fix sudo password issue of removing old data command
Browse files Browse the repository at this point in the history
  • Loading branch information
platfowner committed Aug 1, 2024
1 parent 1c9876e commit 56a12ce
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions deploy_blockchain_genesis_onprem.sh
Original file line number Diff line number Diff line change
Expand Up @@ -351,18 +351,9 @@ if [[ $KEEP_CODE_OPTION = "--no-keep-code" ]]; then
else
GO_TO_PROJECT_ROOT_CMD="cd \$(find /home/ain-blockchain* -maxdepth 0 -type d)"
fi
if [[ $KEEP_DATA_OPTION = "--no-keep-data" ]]; then
# restart after removing chains, snapshots, and log files (but keep the keys)
CHAINS_DIR=/home/ain_blockchain_data/chains
SNAPSHOTS_DIR=/home/ain_blockchain_data/snapshots
LOGS_DIR=/home/ain_blockchain_data/logs
# START_TRACKER_CMD_BASE="sudo rm -rf /home/ain_blockchain_data/ && $GO_TO_PROJECT_ROOT_CMD && . start_tracker_genesis_gcp.sh"
START_NODE_CMD_BASE="sudo rm -rf $CHAINS_DIR $SNAPSHOTS_DIR $LOGS_DIR && $GO_TO_PROJECT_ROOT_CMD && . start_node_genesis_onprem.sh"
else
# restart with existing chains, snapshots, and log files
# START_TRACKER_CMD_BASE="$GO_TO_PROJECT_ROOT_CMD && . start_tracker_genesis_gcp.sh"
START_NODE_CMD_BASE="$GO_TO_PROJECT_ROOT_CMD && . start_node_genesis_onprem.sh"
fi

#START_TRACKER_CMD_BASE="$GO_TO_PROJECT_ROOT_CMD && . start_tracker_genesis_gcp.sh"
START_NODE_CMD_BASE="$GO_TO_PROJECT_ROOT_CMD && . start_node_genesis_onprem.sh"
printf "\n"
#printf "START_TRACKER_CMD_BASE=$START_TRACKER_CMD_BASE\n"
printf "START_NODE_CMD_BASE=$START_NODE_CMD_BASE\n"
Expand Down Expand Up @@ -390,6 +381,15 @@ if [[ $begin_index -le $PARENT_NODE_INDEX_END ]] && [[ $PARENT_NODE_INDEX_END -g
printf "\n"
printf "NODE_TARGET_ADDR=${NODE_TARGET_ADDR}\n"

if [[ $KEEP_DATA_OPTION = "--no-keep-data" ]]; then
printf "\n* >> Removing old data for parent node $node_index (${NODE_TARGET_ADDR}) *********************************************************\n\n"

CHAINS_DIR=/home/ain_blockchain_data/chains
SNAPSHOTS_DIR=/home/ain_blockchain_data/snapshots
LOGS_DIR=/home/ain_blockchain_data/logs
echo ${NODE_LOGIN_PW} | sshpass -f <(printf '%s\n' ${NODE_LOGIN_PW}) ssh -v ${NODE_TARGET_ADDR} "sudo -S rm -rf $CHAINS_DIR $SNAPSHOTS_DIR $LOGS_DIR"
fi

printf "\n* >> Starting parent node $node_index (${NODE_TARGET_ADDR}) *********************************************************\n\n"

if [[ $node_index -ge $JSON_RPC_NODE_INDEX_GE ]] && [[ $node_index -le $JSON_RPC_NODE_INDEX_LE ]]; then
Expand Down

0 comments on commit 56a12ce

Please sign in to comment.