backup
This commit is contained in:
@@ -4,8 +4,30 @@
|
||||
# ==============================================================================
|
||||
#bashio::log.level "info"
|
||||
|
||||
# call Home Assistant to create a local backup
|
||||
# function fails in case local backup is not created
|
||||
function create-local-backup {
|
||||
local -r base_folders="addons/local homeassistant media share ssl"
|
||||
local data="{\"name\":\"${BACKUP_NAME}\"}"
|
||||
local bak_type="non-encrypted"
|
||||
|
||||
bashio::log.info "Creating ${bak_type} full backup: \"${BACKUP_NAME}\""
|
||||
|
||||
if ! SLUG=$(bashio::api.supervisor POST /backups/new/full "${data}" .slug); then
|
||||
bashio::log.fatal "Error creating ${bak_type} full backup!"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
|
||||
|
||||
bashio::log.info "Backup created: ${SLUG}"
|
||||
return "${__BASHIO_EXIT_OK}"
|
||||
}
|
||||
|
||||
|
||||
bashio::log.info "Starting S3 Backup..."
|
||||
|
||||
create-local-backup || die "Local backup process failed! See log for details."
|
||||
|
||||
custom_endpoint="$(bashio::config 'custom_endpoint')"
|
||||
bucket_name="$(bashio::config 'bucket_name')"
|
||||
bucket_region="$(bashio::config 'bucket_region' 'minio')"
|
||||
@@ -20,6 +42,7 @@ export AWS_REGION="$bucket_region"
|
||||
|
||||
bashio::log.debug "Using AWS CLI version: '$(aws --version)'"
|
||||
bashio::log.debug "Command: 'aws s3 sync $monitor_path s3://$bucket_name/ --no-progress --region $bucket_region'"
|
||||
bashio::log.debug "SLUG: $SLUG"
|
||||
|
||||
aws s3 sync \
|
||||
$monitor_path \
|
||||
|
||||
Reference in New Issue
Block a user