fix blank creation label
This commit is contained in:
1 parent
5efc3b03a8
commit
b8873ddb7b
1 file changed
+8
-4
+8
-4
@@ -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
|
||||
|
||||
Reference in new issue
Block a user