From b8873ddb7b86fd551c73f53466bbcb0720d13dc9 Mon Sep 17 00:00:00 2001 From: finn Date: Tue, 22 Sep 2026 11:50:39 -0700 Subject: [PATCH] fix blank creation label --- create-linode.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/create-linode.sh b/create-linode.sh index 7efaf03..69e3c35 100755 --- a/create-linode.sh +++ b/create-linode.sh @@ -1,6 +1,8 @@ #!/bin/bash -# For my use, debian for the little one, ubuntu for the big ones +# Valheim dedicated server spawner +# Attaches persistent vol with saved data +# TODO look into whether crossplay is desired # From .env, following values: # LINODE_API_KEY (used for all Linode API calls below, via curl) @@ -60,7 +62,9 @@ if [[ "$SCRIPT_ACTION" == "" || "$SCRIPT_ACTION" == "--help" || "$SCRIPT_ACTION" fi # Create -if [[ "$SCRIPT_ACTION" == "c" ]]; then +# Requires a non-empty label: an empty label would send a blank label to the +# Linode API and be generally buggy and annoying in all further operations. +if [[ "$SCRIPT_ACTION" == "c" && -n "$LINODE_LABEL" ]]; then # Creating a Linode also refreshes the valheim A record, reusing the update # block at the bottom of this script. @@ -144,13 +148,13 @@ if [[ "$SCRIPT_ACTION" == "d" ]]; then # Shut the Linode down cleanly before deleting it, so systemd stops the # Docker container and the Valheim server gets the chance to save the world # rather than being cut off mid-write. - echo "Shutting down ID:$INSTANCE_ID..." + echo "Soft Shutting down ID:$INSTANCE_ID..." curl -s -H "Authorization: Bearer $LINODE_API_KEY" \ -X POST https://api.linode.com/v4/linode/instances/$INSTANCE_ID/shutdown | jq . # Give the shutdown time to finish before the instance is deleted. sleep 30 - + echo "Deleting instance." curl -s -H "Authorization: Bearer $LINODE_API_KEY" \ -X DELETE https://api.linode.com/v4/linode/instances/$INSTANCE_ID echo "$(date -Iminutes) --- Id:$INSTANCE_ID --- IP:$INSTANCE_IP Destroyed $LINODE_LABEL." >>$LOGFILE