Добавлено удаление старых архивов #1
@ -6,6 +6,7 @@ SKIP_DIRS=
|
|||||||
DIRS=/etc,/var/log
|
DIRS=/etc,/var/log
|
||||||
FILES=/home/user/BashProject/backup.sh,/home/user/jet/restore.sh
|
FILES=/home/user/BashProject/backup.sh,/home/user/jet/restore.sh
|
||||||
[FTP]
|
[FTP]
|
||||||
|
DAYS_TO_KEEP=7
|
||||||
FTP_SERVER=127.0.0.1
|
FTP_SERVER=127.0.0.1
|
||||||
FTP_USER=user
|
FTP_USER=user
|
||||||
FTP_PASS=password
|
FTP_PASS=password
|
||||||
|
@ -112,6 +112,7 @@ TAR_NAME="BACKUP_$(hostname)_$TIMESTAMP.tar.gz"
|
|||||||
FTP_SERVER="$(get_ini_value "FTP" "FTP_SERVER")"
|
FTP_SERVER="$(get_ini_value "FTP" "FTP_SERVER")"
|
||||||
FTP_USER="$(get_ini_value "FTP" "FTP_USER")"
|
FTP_USER="$(get_ini_value "FTP" "FTP_USER")"
|
||||||
FTP_PASS="$(get_ini_value "FTP" "FTP_PASS")"
|
FTP_PASS="$(get_ini_value "FTP" "FTP_PASS")"
|
||||||
|
DAYS_TO_KEEP="$(get_ini_value "FTP" "DAYS_TO_KEEP")"
|
||||||
|
|
||||||
# Создаем временную директорию
|
# Создаем временную директорию
|
||||||
mkdir -p "$TEMP_DIR"
|
mkdir -p "$TEMP_DIR"
|
||||||
@ -188,13 +189,14 @@ if [[ ! -f "$LOG_FILE" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Загружаем файлы на FTP-сервер
|
# Загружаем файлы на FTP-сервер
|
||||||
echo "Sending files ..." >> "$LOG_FILE"
|
echo "Deleting old files and sending files ..." >> "$LOG_FILE"
|
||||||
lftp -u "$FTP_USER","$FTP_PASS" "$FTP_SERVER" <<EOF > ftp_log.txt 2>&1
|
lftp -u "$FTP_USER","$FTP_PASS" "$FTP_SERVER" <<EOF > ftp_log.txt 2>&1
|
||||||
set ssl:verify-certificate no
|
set ssl:verify-certificate no
|
||||||
set net:timeout 10
|
set net:timeout 10
|
||||||
set net:max-retries 3
|
set net:max-retries 3
|
||||||
set net:reconnect-interval-base 5
|
set net:reconnect-interval-base 5
|
||||||
set net:reconnect-interval-multiplier 2
|
set net:reconnect-interval-multiplier 2
|
||||||
|
find . -type f -mtime +$DAYS_TO_KEEP -exec rm {} ;
|
||||||
put "$TAR_NAME"
|
put "$TAR_NAME"
|
||||||
put "$LOG_FILE"
|
put "$LOG_FILE"
|
||||||
bye
|
bye
|
||||||
|
Loading…
Reference in New Issue
Block a user