laconic-network-bootstrap/scripts/delete-network-dirs.sh

29 lines
727 B
Bash
Raw Permalink Normal View History

2024-07-08 12:22:16 +00:00
#!/usr/bin/env bash
set -e
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
2024-07-12 15:38:36 +00:00
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source ${SCRIPT_DIR}/lib.sh
2024-07-08 12:22:16 +00:00
if [[ -n "$1" ]]; then
machine_name_prefix=$1
else
echo "Usage: $0 <machine-name-prefix>"
exit 1
fi
local_gentx_dir=gentx-${machine_name_prefix}
echo "Deleting network dirs on all nodes"
for (( i=1 ; i<=$node_count ; i++ ));
do
node_name=${machine_name_prefix}-${i}.${machine_domain}
2024-07-31 17:34:16 +00:00
change_dir_ownership ${node_name} ${node_network_dir}
2024-07-08 12:22:16 +00:00
echo "Deleting ${node_network_dir} on ${node_name}"
ssh ${ssh_user}@${node_name} rm -rf ${node_network_dir} ${local_gentx_dir}
2024-07-08 12:22:16 +00:00
done
2024-07-31 17:34:16 +00:00
rm -rf ${local_gentx_dir}