This repository has been archived on 2024-03-13. You can view files and clone it, but cannot push or open issues or pull requests.
LinuxUpskillChallenge/day0_delete.sh

28 lines
629 B
Bash
Executable File

#!/bin/bash
#
# Day 0 - Delete script
# Requires linode-cli to be installed (`pip3 install linode-cli`)
#
# The command used below looks like this from command line:
#linode-cli linodes list --format 'id' --label UpskillChallengeNode --text
#id
#34628226
# change the target of this delete script by giving a LABEL value, like this:
# LABEL=DeleteThisNode ./day0_delete.sh
# otherwise, the default "UpskillChallengeNode" will be deleted
if [ -z "$LABEL"]
then
LABEL="UpskillChallengeNode"
fi
ID=$(linode-cli linodes list --format 'id' --label "$LABEL" --text | tail -n 1)
echo $ID
linode-cli linodes delete "$ID"