28 lines
629 B
Bash
28 lines
629 B
Bash
|
#!/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"
|
||
|
|