mirror of
https://github.com/myvesta/vesta.git
synced 2024-11-03 04:00:20 -08:00
57 lines
1.5 KiB
Bash
Executable File
57 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# info: delete backup ftp server
|
|
# options: TYPE
|
|
#
|
|
# The function deletes ftp backup host
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Variable&Function #
|
|
#----------------------------------------------------------#
|
|
|
|
# Argument definition
|
|
type=$1
|
|
|
|
# Includes
|
|
source $VESTA/func/main.sh
|
|
source $VESTA/conf/vesta.conf
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Verifications #
|
|
#----------------------------------------------------------#
|
|
|
|
check_args '1' "$#" 'TYPE [HOST]'
|
|
types=$(echo "$BACKUP_SYSTEM" |sed "s/,/\n/g" |grep "^$type$")
|
|
if [ -z "$types" ]; then
|
|
echo "Error: invalid backup type"
|
|
log_event "$E_INVALID" "$ARGUMENTS"
|
|
exit $E_INVALID
|
|
fi
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Action #
|
|
#----------------------------------------------------------#
|
|
|
|
# Deleting host config
|
|
rm -f $VESTA/conf/$type.backup.conf
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Vesta #
|
|
#----------------------------------------------------------#
|
|
|
|
# Updating vesta.conf
|
|
bckp=$(echo "$BACKUP_SYSTEM" |\
|
|
sed "s/,/\n/g"|\
|
|
sed "s/^$type$//" |\
|
|
sed "/^$/d"|\
|
|
sed ':a;N;$!ba;s/\n/,/g')
|
|
sed -i "s/BACKUP_SYSTEM=.*/BACKUP_SYSTEM='$bckp'/g" $VESTA/conf/vesta.conf
|
|
|
|
# Logging
|
|
log_event "$OK" "$ARGUMENTS"
|
|
|
|
exit
|