From aa663922a856e67d4d00f5e70aa5ee8a2dd260c0 Mon Sep 17 00:00:00 2001 From: Raymond Sukanto Date: Fri, 12 Jul 2024 17:49:16 -0400 Subject: [PATCH 1/2] auto clean up --- examples/morpheusvm/scripts/deploy.devnet.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/examples/morpheusvm/scripts/deploy.devnet.sh b/examples/morpheusvm/scripts/deploy.devnet.sh index c7de611fd8..d51d748f4a 100755 --- a/examples/morpheusvm/scripts/deploy.devnet.sh +++ b/examples/morpheusvm/scripts/deploy.devnet.sh @@ -173,10 +173,19 @@ EOF # Setup devnet CLUSTER="vryx-$(date +%s)" -function cleanup { + +function showcleanup { echo -e "\n\n${RED}run this command to destroy the devnet:${NC} ${TMPDIR}/avalanche node destroy ${CLUSTER}\n" } -trap cleanup EXIT + +function cleanup { + echo -e "\n\n${RED}destroying the devnet, running:${NC} ${TMPDIR}/avalanche node destroy ${CLUSTER}\n" + ${TMPDIR}/avalanche node destroy ${CLUSTER} -y +} + +trap showcleanup EXIT +trap cleanup SIGINT + # List of supported instances in each AWS region: https://docs.aws.amazon.com/ec2/latest/instancetypes/ec2-instance-regions.html # # It is not recommended to use an instance with burstable network performance. From 1b7ccbe043a09d92376daffdbf4f850321f73c9f Mon Sep 17 00:00:00 2001 From: Raymond Sukanto Date: Fri, 12 Jul 2024 18:05:56 -0400 Subject: [PATCH 2/2] Update deploy.devnet.sh --- examples/morpheusvm/scripts/deploy.devnet.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/morpheusvm/scripts/deploy.devnet.sh b/examples/morpheusvm/scripts/deploy.devnet.sh index d51d748f4a..9466306698 100755 --- a/examples/morpheusvm/scripts/deploy.devnet.sh +++ b/examples/morpheusvm/scripts/deploy.devnet.sh @@ -174,11 +174,15 @@ EOF # Setup devnet CLUSTER="vryx-$(date +%s)" +interrupted=false function showcleanup { - echo -e "\n\n${RED}run this command to destroy the devnet:${NC} ${TMPDIR}/avalanche node destroy ${CLUSTER}\n" + if [ "$interrupted" = false ]; then + echo -e "\n\n${RED}run this command to destroy the devnet:${NC} ${TMPDIR}/avalanche node destroy ${CLUSTER}\n" + fi } function cleanup { + interrupted=true echo -e "\n\n${RED}destroying the devnet, running:${NC} ${TMPDIR}/avalanche node destroy ${CLUSTER}\n" ${TMPDIR}/avalanche node destroy ${CLUSTER} -y }