Skip to content

Commit 0f7110b

Browse files
committed
option to disable local backups
1 parent 2c42044 commit 0f7110b

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

bin/v-delete-backup-host

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
# info: delete backup ftp server
3-
# options: NONE
3+
# options: TYPE
44
#
55
# The function deletes ftp backup host
66

@@ -9,6 +9,9 @@
99
# Variable&Function #
1010
#----------------------------------------------------------#
1111

12+
# Argument defenition
13+
type=$1
14+
1215
# Includes
1316
source $VESTA/func/main.sh
1417
source $VESTA/conf/vesta.conf
@@ -18,23 +21,31 @@ source $VESTA/conf/vesta.conf
1821
# Verifications #
1922
#----------------------------------------------------------#
2023

24+
check_args '1' "$#" 'TYPE [HOST]'
25+
types=$(echo "$BACKUP_SYSTEM" |sed "s/,/\n/g" |grep "^$type$")
26+
if [ -z "$types" ]; then
27+
echo "Error: invalid backup type"
28+
log_event "$E_INVALID" "$EVENT"
29+
exit $E_INVALID
30+
fi
31+
2132

2233
#----------------------------------------------------------#
2334
# Action #
2435
#----------------------------------------------------------#
2536

26-
# Checking network connection
27-
rm -f $VESTA/conf/ftp.backup.conf
37+
# Deleting host config
38+
rm -f $VESTA/conf/$type.backup.conf
2839

2940

3041
#----------------------------------------------------------#
3142
# Vesta #
3243
#----------------------------------------------------------#
3344

34-
# Update vesta.conf
45+
# Updating vesta.conf
3546
bckp=$(echo "$BACKUP_SYSTEM" |\
3647
sed "s/,/\n/g"|\
37-
sed "s/^ftp$//" |\
48+
sed "s/^$type$//" |\
3849
sed "/^$/d"|\
3950
sed ':a;N;$!ba;s/\n/,/g')
4051
sed -i "s/BACKUP_SYSTEM=.*/BACKUP_SYSTEM='$bckp'/g" $VESTA/conf/vesta.conf

0 commit comments

Comments
 (0)