File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed
Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22# info: delete backup ftp server
3- # options: NONE
3+ # options: TYPE
44#
55# The function deletes ftp backup host
66
99# Variable&Function #
1010# ----------------------------------------------------------#
1111
12+ # Argument defenition
13+ type=$1
14+
1215# Includes
1316source $VESTA /func/main.sh
1417source $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
3546bckp=$( 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' )
4051sed -i " s/BACKUP_SYSTEM=.*/BACKUP_SYSTEM='$bckp '/g" $VESTA /conf/vesta.conf
You can’t perform that action at this time.
0 commit comments