#!/bin/bash
# info: delete backup ftp server
# options: [NONE]
#
# example: v-delete-backup-host sftp
#
# This function deletes ftp backup host

#----------------------------------------------------------#
#                Variables & Functions                     #
#----------------------------------------------------------#

# Argument definition

# Includes
# shellcheck source=/etc/hestiacp/hestia.conf
source /etc/hestiacp/hestia.conf
# shellcheck source=/usr/local/hestia/func/main.sh
source $HESTIA/func/main.sh
# load config file
source_conf "$HESTIA/conf/hestia.conf"

#----------------------------------------------------------#
#                    Verifications                         #
#----------------------------------------------------------#

# Perform verification if read-only mode is enabled
check_hestia_demo_mode

#----------------------------------------------------------#
#                       Action                             #
#----------------------------------------------------------#

# Deleting host config
rm -f $HESTIA/conf/restic.conf

#----------------------------------------------------------#
#                       Hestia                             #
#----------------------------------------------------------#

$BIN/v-change-sys-config-value 'BACKUP_INCREMENTAL' 'no'

# Logging
$BIN/v-log-action "system" "Info" "Backup" "Removed remote backup host (Type: Restic)."
log_event "$OK" "$ARGUMENTS"

exit
