Bashスクリプトの空白行は「見つかりません」を示します。

Bashスクリプトの空白行は「見つかりません」を示します。

正しく動作しないスクリプトがあります。同じスクリプトについて質問して動作するようにしました。先日。しかし、今、私は同じスクリプトで異なるエラーが発生しているのですが、その理由はわかりません。

次のエラーメッセージが表示されます。

: not foundntstore.sh: 4: restore_eventstore.sh:
: not foundntstore.sh: 6: restore_eventstore.sh:
restore_eventstore.sh: 46: restore_eventstore.sh: Syntax error: end of file unexpected (expecting "then")

私が走るとき

sh restore_eventstore.sh 2023-01-04-03-00.tar.gz

スクリプト:

#!/bin/bash
# Needs azure cli to work.
# Install command: curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

backup_name=$1

if [ -z "$backup_name" ]
then
    echo "Must supply an file to use in the restore"
    exit
fi

export AZURE_STORAGE_ACCOUNT=stocombackups
export AZURE_STORAGE_KEY=HIDDENFORSTACKOVERFLOW

echo "Downloading backup $backup_name from blob storage"
az storage blob download --container-name node1backups --name $backup_name --file $backup_name

if [ ! -s "$backup_name" ]
then
    echo "Failed to download the backup file $backup_name"
    exit
fi

echo "Stopping the eventstore service"
systemctl stop eventstore

if [ -d eventstore_backup ]
then
    echo "Removing old local eventstore backup"
    rm -rf eventstore_backup
fi
echo "Doing an backup of the current db to eventstore_backup"
mkdir eventstore_backup
cp -r db/* eventstore_backup

echo "Removing the old data from eventstore db directory"
rm -rf db/*

echo "Unpacking the backup $backup_name into the eventstore db directory"
tar -zvxf $backup_name -C db/

echo "Truncate the eventstore data to the latest chaser checkpoint"
cp db/chaser.chk db/truncate.chk

echo "Restore is complete. Start the eventstore service with: sudo systemctl start eventstore"

ベストアンサー1

おすすめ記事